diff options
| author | Luke Kanies <luke@madstop.com> | 2009-04-16 23:28:17 -0500 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-04-17 16:17:58 +1000 |
| commit | 47933347797b61e8a8ba71980396862fddd950f0 (patch) | |
| tree | 11120b1de5d7716bce35b1854029ab33613d7d14 | |
| parent | 7398fa171fdd6dcaeb2d8fd1c07a23bbd78891d0 (diff) | |
| download | puppet-47933347797b61e8a8ba71980396862fddd950f0.tar.gz puppet-47933347797b61e8a8ba71980396862fddd950f0.tar.xz puppet-47933347797b61e8a8ba71980396862fddd950f0.zip | |
Fixing puppet -e; it got broken in the move to Application
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | lib/puppet/application/puppet.rb | 4 | ||||
| -rw-r--r-- | spec/unit/application/puppet.rb | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/puppet/application/puppet.rb b/lib/puppet/application/puppet.rb index f576f424f..ce88a6868 100644 --- a/lib/puppet/application/puppet.rb +++ b/lib/puppet/application/puppet.rb @@ -8,7 +8,9 @@ Puppet::Application.new(:puppet) do should_parse_config option("--debug","-d") - option("--execute EXECUTE","-e") + option("--execute EXECUTE","-e") do |arg| + options[:code] = arg + end option("--loadclasses","-L") option("--verbose","-v") option("--use-nodes") diff --git a/spec/unit/application/puppet.rb b/spec/unit/application/puppet.rb index 13b572d8f..0fbfbe591 100644 --- a/spec/unit/application/puppet.rb +++ b/spec/unit/application/puppet.rb @@ -11,7 +11,7 @@ describe "Puppet" do Puppet::Util::Log.stubs(:level=) end - [:debug,:execute,:loadclasses,:verbose,:use_nodes,:detailed_exitcodes].each do |option| + [:debug,:loadclasses,:verbose,:use_nodes,:detailed_exitcodes].each do |option| it "should declare handle_#{option} method" do @puppet.should respond_to("handle_#{option}".to_sym) end @@ -22,6 +22,11 @@ describe "Puppet" do end end + it "should set the code to the provided code when :execute is used" do + @puppet.options.expects(:[]=).with(:code, 'arg') + @puppet.send("handle_execute".to_sym, 'arg') + end + it "should ask Puppet::Application to parse Puppet configuration file" do @puppet.should_parse_config?.should be_true end |
