From 1603f7363728dc41f67cd189ca0dcbf074ec44b4 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Thu, 18 Mar 2010 19:01:29 -0700 Subject: Feature #3394 REST Runner, preparation Rename Puppet::Agent::Runner to Puppet::Run, for consistency --- lib/puppet/agent/runner.rb | 65 ---------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 lib/puppet/agent/runner.rb (limited to 'lib/puppet/agent') diff --git a/lib/puppet/agent/runner.rb b/lib/puppet/agent/runner.rb deleted file mode 100644 index 705b6c269..000000000 --- a/lib/puppet/agent/runner.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'puppet/agent' -require 'puppet/configurer' -require 'puppet/indirector' - -# A basic class for running the agent. Used by -# puppetrun to kick off agents remotely. -class Puppet::Agent::Runner - extend Puppet::Indirector - indirects :runner, :terminus_class => :rest - - attr_reader :status, :background, :options - - def agent - Puppet::Agent.new(Puppet::Configurer) - end - - def background? - background - end - - def initialize(options = {}) - if options.include?(:background) - @background = options[:background] - options.delete(:background) - end - - valid_options = [:tags, :ignoreschedules] - options.each do |key, value| - raise ArgumentError, "Runner does not accept %s" % key unless valid_options.include?(key) - end - - @options = options - end - - def log_run - msg = "" - msg += "triggered run" % - if options[:tags] - msg += " with tags %s" % options[:tags] - end - - if options[:ignoreschedules] - msg += " ignoring schedules" - end - - Puppet.notice msg - end - - def run - if agent.running? - @status = "running" - return - end - - log_run() - - if background? - Thread.new { agent.run(options) } - else - agent.run(options) - end - - @status = "success" - end -end -- cgit