+1 On Jul 2, 2009, at 11:33 AM, Brice Figureau wrote:
> > This is to fix puppetdoc boolean parameters. > Puppetdoc defers sending parameters to Puppet::Util::Setting, and > in this case, boolean parameters are stored as a boolean value. > > Signed-off-by: Brice Figureau <[email protected]> > --- > lib/puppet/util/settings.rb | 4 ++-- > spec/unit/util/settings.rb | 7 +++++++ > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb > index 4fbf602..92aadcb 100644 > --- a/lib/puppet/util/settings.rb > +++ b/lib/puppet/util/settings.rb > @@ -827,8 +827,8 @@ Generated on #{Time.now}. > def munge_value(value) > # Handle different data types correctly > return case value > - when /^false$/i; false > - when /^true$/i; true > + when /^false$/i, false; false > + when /^true$/i, true; true > when /^\d+$/i; Integer(value) > else > value.gsub(/^["']|["']$/,'').sub(/\s+$/, '') > diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb > index c700c0c..5e9ab3a 100755 > --- a/spec/unit/util/settings.rb > +++ b/spec/unit/util/settings.rb > @@ -104,6 +104,13 @@ describe Puppet::Util::Settings do > @settings[:bool].should == true > end > > + it "should consider a cli setting with a boolean as an > argument to be a boolean" do > + # Turn it off first > + @settings[:bool] = false > + @settings.handlearg("--bool", true) > + @settings[:bool].should == true > + end > + > it "should clear the cache when setting getopt-specific > values" do > @settings.setdefaults :mysection, :one => ["whah", > "yay"], :two => ["$one yay", "bah"] > @settings[:two].should == "whah yay" > -- > 1.6.0.2 > > > > -- Don't throw away the old bucket until you know whether the new one holds water. -- Swedish Proverb --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
