summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/concat.rb6
-rw-r--r--lib/puppet/parser/functions/private.rb29
-rw-r--r--lib/puppet/type/file_line.rb3
3 files changed, 33 insertions, 5 deletions
diff --git a/lib/puppet/parser/functions/concat.rb b/lib/puppet/parser/functions/concat.rb
index 6c86382..0d35b07 100644
--- a/lib/puppet/parser/functions/concat.rb
+++ b/lib/puppet/parser/functions/concat.rb
@@ -28,11 +28,7 @@ Would result in:
raise(Puppet::ParseError, 'concat(): Requires array to work with')
end
- if b.is_a?(Array)
- result = a.concat(b)
- else
- result = a << b
- end
+ result = a + Array(b)
return result
end
diff --git a/lib/puppet/parser/functions/private.rb b/lib/puppet/parser/functions/private.rb
new file mode 100644
index 0000000..60210d3
--- /dev/null
+++ b/lib/puppet/parser/functions/private.rb
@@ -0,0 +1,29 @@
+#
+# private.rb
+#
+
+module Puppet::Parser::Functions
+ newfunction(:private, :doc => <<-'EOS'
+ Sets the current class or definition as private.
+ Calling the class or definition from outside the current module will fail.
+ EOS
+ ) do |args|
+
+ raise(Puppet::ParseError, "private(): Wrong number of arguments "+
+ "given (#{args.size}}) for 0 or 1)") if args.size > 1
+
+ scope = self
+ if scope.lookupvar('module_name') != scope.lookupvar('caller_module_name')
+ message = nil
+ if args[0] and args[0].is_a? String
+ message = args[0]
+ else
+ manifest_name = scope.source.name
+ manifest_type = scope.source.type
+ message = (manifest_type.to_s == 'hostclass') ? 'Class' : 'Definition'
+ message += " #{manifest_name} is private"
+ end
+ raise(Puppet::ParseError, message)
+ end
+ end
+end
diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb
index 323fc4c..9dbe43c 100644
--- a/lib/puppet/type/file_line.rb
+++ b/lib/puppet/type/file_line.rb
@@ -21,6 +21,9 @@ Puppet::Type.newtype(:file_line) do
In this example, Puppet will ensure both of the specified lines are
contained in the file /etc/sudoers.
+ **Autorequires:** If Puppet is managing the file that will contain the line
+ being managed, the file_line resource will autorequire that file.
+
EOT
ensurable do