From ed56ce78467ce917fe1f50b88c4ebfa0bbf26a6d Mon Sep 17 00:00:00 2001 From: haiwu Date: Sun, 24 Jun 2012 15:18:16 -0500 Subject: [PATCH 1/2] Update master --- agent/puppetd/agent/puppetd.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/agent/puppetd/agent/puppetd.rb b/agent/puppetd/agent/puppetd.rb index 49372df..842300f 100644 --- a/agent/puppetd/agent/puppetd.rb +++ b/agent/puppetd/agent/puppetd.rb @@ -135,6 +135,14 @@ def runonce_background cmd << "--splaylimit" << @splaytime << "--splay" end end + + if request[:noop] + cmd << "--noop" + end + + if request[:nonoop] + cmd << "--no-noop" + end cmd = cmd.join(" ") From d340bfbbd78813e110baf1649d3f26e5828931ce Mon Sep 17 00:00:00 2001 From: haiwu Date: Sun, 24 Jun 2012 15:21:08 -0500 Subject: [PATCH 2/2] Update master --- agent/puppetd/application/puppetd.rb | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/agent/puppetd/application/puppetd.rb b/agent/puppetd/application/puppetd.rb index 57a9c01..a2575de 100644 --- a/agent/puppetd/application/puppetd.rb +++ b/agent/puppetd/application/puppetd.rb @@ -21,6 +21,16 @@ class MCollective::Application::Puppetd "Force the puppet run to happen immediately without splay", :arguments => ["--force", "-f"], :type => :bool + + option :noop, + :description => "Run the puppet in noop mode", + :arguments => ["--noop"], + :type => :bool + + option :nonoop, + :description => "Run the puppet in no-noop mode", + :arguments => ["--no-noop"], + :type => :bool def post_option_parser(configuration) if ARGV.length >= 1 @@ -76,6 +86,16 @@ def main hosts = mc.discover.sort log("Found #{hosts.size} hosts") + if configuration[:noop] + parameters = { :forcerun => true, :noop => configuration[:noop] } + else + if configuration[:nonoop] + parameters = { :forcerun => true, :nonoop => configuration[:nonoop] } + else + parameters = { :forcerun => true } + end + end + # For all hosts: # - check for concurrent runs, wait till its below threshold # - do a run on the single host, regardless of if its already running @@ -84,7 +104,7 @@ def main hosts.each do |host| running = waitfor(configuration[:concurrency], mc) log("Running #{host}, concurrency is #{running}") - result = mc.custom_request("runonce", {:forcerun => true}, host, {"identity" => host}) + result = mc.custom_request("runonce", parameters, host, {"identity" => host}) begin log("#{host} schedule status: #{result[0][:statusmsg]}") @@ -100,7 +120,16 @@ def main end when "runonce" - printrpc mc.runonce(:forcerun => configuration[:force]) + if configuration[:noop] + parameters = { :forcerun => configuration[:force], + :noop => configuration[:noop] } + else + if configuration[:nonoop] + parameters = { :forcerun => configuration[:force], + :nonoop => configuration[:nonoop] } + end + end + printrpc mc.runonce(parameters) when "status" mc.send(configuration[:command]).each do |node|