forked from example42/puppi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_class_args.rb
32 lines (25 loc) · 934 Bytes
/
get_class_args.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# This function is based on Ken Barber's get_scope_args
# It has been slightly changed and renamed to avoid naming clash
module Puppet::Parser::Functions
newfunction(:get_class_args, :type => :rvalue, :doc => <<-EOS
This function will return all arguments passed to the current scope. This could
be a class or defined resource.
EOS
) do |arguments|
if (arguments.size != 0) then
raise(Puppet::ParseError, "validate_resource(): Wrong number of arguments "+
"given #{arguments.size} for 0")
end
# Grab the current scope, turn it to a hash but do not be recursive
# about it.
classhash = to_hash(recursive=false)
# Strip bits that do not matter for validation
# classhash.delete("name")
# classhash.delete("title")
# classhash.delete("caller_module_name")
# classhash.delete("module_name")
# Return munged classhash
classhash
end
end
# vim: set ts=2 sw=2 et :