summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-03-18 18:48:46 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitd8e1b272ec321d5f86558672252de60983751a15 (patch)
tree45f4797b3512127b9f4c4400fb444f96bd3e80b9 /lib/puppet/application
parent1603f7363728dc41f67cd189ca0dcbf074ec44b4 (diff)
downloadpuppet-d8e1b272ec321d5f86558672252de60983751a15.tar.gz
puppet-d8e1b272ec321d5f86558672252de60983751a15.tar.xz
puppet-d8e1b272ec321d5f86558672252de60983751a15.zip
Feature #3394 REST runner, execution
puppetrun uses REST to trigger puppet runs.
Diffstat (limited to 'lib/puppet/application')
-rw-r--r--lib/puppet/application/run.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/puppet/application/run.rb b/lib/puppet/application/run.rb
index f08fade8d..26ca362ff 100644
--- a/lib/puppet/application/run.rb
+++ b/lib/puppet/application/run.rb
@@ -112,14 +112,22 @@ Puppet::Application.new(:run) do
next
end
end
- client = Puppet::Network::Client.runner.new(
- :Server => host,
- :Port => Puppet[:puppetport]
- )
+
+ require 'puppet/run'
+ Puppet::Run.indirection.terminus_class = :rest
+ port = Puppet[:puppetport]
+ url = ["https://#{host}:#{port}", "production", "run", host].join('/')
print "Triggering %s\n" % host
begin
- result = client.run(@tags, options[:ignoreschedules] || false, options[:foreground] || false)
+ request = Puppet::Indirector::Request.new(:run, :save, url) # Yuck.
+ run_options = {
+ :tags => @tags,
+ :background => ! options[:foreground],
+ :ignoreschedules => options[:ignoreschedules]
+ }
+ run = Puppet::Run.new( run_options ).save( request )
+ result = run.status
rescue => detail
puts detail.backtrace if Puppet[:trace]
$stderr.puts "Host %s failed: %s\n" % [host, detail]
@@ -183,12 +191,6 @@ Puppet::Application.new(:run) do
exit(24)
end
- if @tags.empty?
- @tags = ""
- else
- @tags = @tags.join(",")
- end
-
@children = {}
# If we get a signal, then kill all of our children and get out.