diff options
-rw-r--r-- | lib/puppet/application/run.rb | 5 | ||||
-rwxr-xr-x | spec/unit/application/run.rb (renamed from spec/unit/application/puppetrun.rb) | 14 |
2 files changed, 11 insertions, 8 deletions
diff --git a/lib/puppet/application/run.rb b/lib/puppet/application/run.rb index 46d1b191f..395ba987b 100644 --- a/lib/puppet/application/run.rb +++ b/lib/puppet/application/run.rb @@ -126,7 +126,9 @@ Puppet::Application.new(:run) do :ignoreschedules => options[:ignoreschedules] } run = Puppet::Run.new( run_options ).save( url ) + puts "Getting status" result = run.status + puts "status is #{result}" rescue => detail puts detail.backtrace if Puppet[:trace] $stderr.puts "Host %s failed: %s\n" % [host, detail] @@ -134,7 +136,8 @@ Puppet::Application.new(:run) do end case result - when "success"; exit(0) + when "success"; + exit(0) when "running" $stderr.puts "Host %s is already running" % host exit(3) diff --git a/spec/unit/application/puppetrun.rb b/spec/unit/application/run.rb index f8ca48061..bb76c5b59 100755 --- a/spec/unit/application/puppetrun.rb +++ b/spec/unit/application/run.rb @@ -250,21 +250,21 @@ describe "run" do options = { :background => true, :ignoreschedules => false, :tags => [] } - @run = Puppet::Run.new( options.dup ) - @run.stubs(:status).returns("success") + @agent_run = Puppet::Run.new( options.dup ) + @agent_run.stubs(:status).returns("success") Puppet::Run.indirection.expects(:terminus_class=).with( :rest ) - Puppet::Run.expects(:new).with( options ).returns(@run) + Puppet::Run.expects(:new).with( options ).returns(@agent_run) end it "should call run on a Puppet::Run for the given host" do - @run.expects(:save).with('https://host:8139/production/run/host').returns(@run) + @agent_run.expects(:save).with('https://host:8139/production/run/host').returns(@agent_run) @run.run_for_host('host') end it "should exit the child with 0 on success" do - @run.stubs(:status).returns("success") + @agent_run.stubs(:status).returns("success") @run.expects(:exit).with(0) @@ -272,7 +272,7 @@ describe "run" do end it "should exit the child with 3 on running" do - @run.stubs(:status).returns("running") + @agent_run.stubs(:status).returns("running") @run.expects(:exit).with(3) @@ -280,7 +280,7 @@ describe "run" do end it "should exit the child with 12 on unknown answer" do - @run.stubs(:status).returns("whatever") + @agent_run.stubs(:status).returns("whatever") @run.expects(:exit).with(12) |