+1 On Wed, Sep 22, 2010 at 4:56 PM, Jacob Helwig <[email protected]> wrote:
> > Signed-off-by: Jacob Helwig <[email protected]> > --- > > This is an alternate solution to that proposed in > http://projects.puppetlabs.com/issues/4743 > > lib/puppet/type.rb | 6 +++--- > spec/unit/type_spec.rb | 7 +++++++ > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb > index f9aacec..1b6e7dc 100644 > --- a/lib/puppet/type.rb > +++ b/lib/puppet/type.rb > @@ -965,7 +965,7 @@ class Type > the value, and any changes already get logged." > > validate do |list| > - list = Array(list) > + list = Array(list).collect {|p| p.to_sym} > unless list == [:all] > list.each do |param| > next if @resource.class.validattr?(param) > @@ -990,8 +990,8 @@ class Type > end > > def properties_to_audit(list) > - if list == :all > - list = all_properties if list == :all > + if !list.kind_of?(Array) && list.to_sym == :all > + list = all_properties > else > list = Array(list).collect { |p| p.to_sym } > end > diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb > index 487750e..48b00ec 100755 > --- a/spec/unit/type_spec.rb > +++ b/spec/unit/type_spec.rb > @@ -545,6 +545,13 @@ describe Puppet::Type.metaparamclass(:audit) do > @resource[:audit].should == list > end > > + it "should accept the string 'all' to specify auditing all possible > properties" do > + @resource[:audit] = 'all' > + > + list = @resource.class.properties.collect { |p| p.name } > + @resource[:audit].should == list > + end > + > it "should fail if asked to audit an invalid property" do > lambda { @resource[:audit] = :foobar }.should > raise_error(Puppet::Error) > end > -- > 1.7.3 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<puppet-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
