Check for the number of arguments given.
This commit is contained in:
parent
49d208a13e
commit
0eea8ac101
1 changed files with 11 additions and 3 deletions
14
load_vars.rb
14
load_vars.rb
|
@ -40,11 +40,19 @@
|
|||
#
|
||||
|
||||
module Puppet::Parser::Functions
|
||||
newfunction(:load_vars, :type => :statement) do |args|
|
||||
newfunction(:load_vars, :type => :statement) do |arguments|
|
||||
|
||||
number_of_arguments = arguments.size
|
||||
|
||||
if number_of_arguments < 2
|
||||
raise(Puppet::ParseError, "Wrong number of arguments " +
|
||||
"given (#{number_of_arguments} for 2)")
|
||||
end
|
||||
|
||||
data = {}
|
||||
|
||||
file = args[0]
|
||||
key = args[1] if args[1]
|
||||
file = arguments[0]
|
||||
key = arguments[1] if arguments[1]
|
||||
|
||||
if File.exists?(file)
|
||||
|
||||
|
|
Loading…
Reference in a new issue