On Mon, May 23, 2011 at 02:39:40PM -0700, Dan Bode wrote: > :name is special (and hardcoded) in several parts of the Puppet code. Could > you try using some other name that :name and see if it resolves those > issues? >
Doesnt resolve the issue. The test did pass before I applied your
patch. Here are the modified namevar_join and title_patterns methods
(replaced :name with :path)
def self.namevar_join(hash)
"#{hash[:path]}/#{hash[:protocol]}"
end
def self.title_patterns
[
# we have two title_patterns "name" and "name:protocol". We won't use
# one pattern (that will eventually set :protocol to nil) because we
# want to use a default value for :protocol. And that does only work
# when :protocol is not put in the parameter hash while initialising
[
/^(.*)\/(tcp|udp)$/, # Set name and protocol
[
# We don't need a lot of post-parsing
[ :path, lambda{|x| x} ],
[ :protocol, lambda{ |x| x.intern } ]
]
],
[
/^(.*)$/,
[
[ :path, lambda{|x| x} ]
]
]
]
end
validate do
unless @parameters[:path] and @parameters[:protocol]
raise Puppet::Error, "Attributes 'name' and 'protocol' are mandatory"
end
end
* Specifying just :path raises an error if I remove the default on
:protocol (:protocol is missing)
* Specifying just :protocol should raise an error (:path is missing) but
does not because class.new(:protocol => :tcp)[:path] is "" instead
-Stefan
pgp0eC0ylpwE5.pgp
Description: PGP signature
