Class: Guard::Puppet::Runner
- Inherits:
-
Object
- Object
- Guard::Puppet::Runner
- Defined in:
- lib/guard/puppet/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #command_line_params ⇒ Object
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 16 17 |
# File 'lib/guard/puppet/runner.rb', line 11 def initialize() = { :verbose => true, :manifest => 'manifests/site.pp' }.merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/guard/puppet/runner.rb', line 9 def end |
Instance Method Details
#command_line_params ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/guard/puppet/runner.rb', line 48 def command_line_params command = [ "apply", %{--confdir="#{Dir.pwd}"} ] command << "-v" if [:verbose] command << "-d" if [:debug] command << [:manifest] if [:manifest] command end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/guard/puppet/runner.rb', line 19 def run = ::Puppet::Util::Log.newdestination(:guard) begin maybe_bundle_with_env do # TODO: hack, untested, needed to avoid: # #"Error: Could not initialize global default settings: # Attempting to initialize global default settings more than once!" ::Puppet.settings.send(:clear_everything_for_tests) ::Puppet::Util::CommandLine.new('puppet', command_line_params).execute end 0 rescue SystemExit => e if e.status == 0 if .has_failed? 1 else 0 end else e.status end ensure ::Puppet::Util::Log.close(:guard) end end |