diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-07-28 15:08:00 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-07-28 15:20:54 -0700 |
| commit | 023d9597b9895f57fda05dc79adad41684179eb2 (patch) | |
| tree | 4afcc71e22a35d548f138b90e4fbc03157652084 | |
| parent | bad0442f78d42fbdce3555faefa80886618f0001 (diff) | |
| download | puppet-023d9597b9895f57fda05dc79adad41684179eb2.tar.gz puppet-023d9597b9895f57fda05dc79adad41684179eb2.tar.xz puppet-023d9597b9895f57fda05dc79adad41684179eb2.zip | |
(#8690) Accept 'global' options in Puppet Faces
When we introduced verification of options, we forgot to handle the case that
global options from the Puppet settings system could be passed to the face.
This, in turn, means that the system would fail if you used any of those.
This remediates that, and now these work as expected.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
| -rw-r--r-- | lib/puppet/interface/action.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/interface/action_spec.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/puppet/interface/action.rb b/lib/puppet/interface/action.rb index bd47a36ea..60ddb2ca3 100644 --- a/lib/puppet/interface/action.rb +++ b/lib/puppet/interface/action.rb @@ -269,6 +269,8 @@ WRAPPER else result[canonical] = original[name] end + elsif Puppet.settings.include? name + result[name] = original[name] else unknown << name end diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb index c3f08e817..6b68eb149 100755 --- a/spec/unit/interface/action_spec.rb +++ b/spec/unit/interface/action_spec.rb @@ -552,7 +552,7 @@ describe Puppet::Interface::Action do context "#validate_and_clean" do subject do Puppet::Interface.new(:validate_args, '1.0.0') do - script :test do |options| true end + script :test do |options| options end end end @@ -576,6 +576,12 @@ describe Puppet::Interface::Action do expect { subject.test :unknown => true, :unseen => false }. to raise_error ArgumentError, /Unknown options passed: unknown, unseen/ end + + it "should accept 'global' options from settings" do + expect { + subject.test(:certname => "true").should == { :certname => "true" } + }.not_to raise_error + end end context "default option values" do |
