summaryrefslogtreecommitdiffstats
path: root/lib/puppet/agent
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-03-18 19:01:29 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit1603f7363728dc41f67cd189ca0dcbf074ec44b4 (patch)
tree022fa3e476f75ef536e4db4704a1bd4e813ac729 /lib/puppet/agent
parent16658a0403135bc23ce18bcf2c72c4725ac25faf (diff)
downloadpuppet-1603f7363728dc41f67cd189ca0dcbf074ec44b4.tar.gz
puppet-1603f7363728dc41f67cd189ca0dcbf074ec44b4.tar.xz
puppet-1603f7363728dc41f67cd189ca0dcbf074ec44b4.zip
Feature #3394 REST Runner, preparation
Rename Puppet::Agent::Runner to Puppet::Run, for consistency
Diffstat (limited to 'lib/puppet/agent')
-rw-r--r--lib/puppet/agent/runner.rb65
1 files changed, 0 insertions, 65 deletions
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