This is a Luke patch that I mined from his github. On Wed, Feb 3, 2010 at 2:09 PM, Jesse Wolfe <[email protected]> wrote:
> From: Luke Kanies <[email protected]> > > Some tests didn't define this setting which caused this method > to fail. > > Signed-off-by: Luke Kanies <[email protected]> > Signed-off-by: Jesse Wolfe <[email protected]> > --- > lib/puppet/util/settings.rb | 5 ++--- > spec/unit/util/settings.rb | 7 +++++++ > 2 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb > index e6e1333..3a28c46 100644 > --- a/lib/puppet/util/settings.rb > +++ b/lib/puppet/util/settings.rb > @@ -163,11 +163,10 @@ class Puppet::Util::Settings > end > > def without_noop > - old_noop = value(:noop,:cli) > - set_value(:noop, false, :cli) > + old_noop = value(:noop,:cli) and set_value(:noop, false, :cli) if > valid?(:noop) > yield > ensure > - set_value(:noop, old_noop, :cli) > + set_value(:noop, old_noop, :cli) if valid?(:noop) > end > > def include?(name) > diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb > index 4855df4..8cc7488 100755 > --- a/spec/unit/util/settings.rb > +++ b/spec/unit/util/settings.rb > @@ -1034,5 +1034,12 @@ describe Puppet::Util::Settings do > @settings.without_noop { raise } rescue nil > @settings.value(:noop, :cli).should be_true > end > + > + it "should work even if no 'noop' setting is available" do > + settings = Puppet::Util::Settings.new > + stuff = nil > + settings.without_noop { stuff = "yay" } > + stuff.should == "yay" > + end > end > end > -- > 1.6.3.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.
