Class: PuppetCommand
- Inherits:
-
Object
- Object
- PuppetCommand
- Defined in:
- lib/kafo/puppet_command.rb
Instance Method Summary collapse
- #add_progress ⇒ Object
- #append(suffix) ⇒ Object
- #command ⇒ Object
- #custom_answer_file ⇒ Object
-
#initialize(command, options = []) ⇒ PuppetCommand
constructor
A new instance of PuppetCommand.
Constructor Details
#initialize(command, options = []) ⇒ PuppetCommand
Returns a new instance of PuppetCommand.
3 4 5 6 7 |
# File 'lib/kafo/puppet_command.rb', line 3 def initialize(command, = []) @command = command @options = .push("--modulepath #{modules_path}") @logger = KafoConfigure.logger end |
Instance Method Details
#add_progress ⇒ Object
13 14 15 |
# File 'lib/kafo/puppet_command.rb', line 13 def add_progress KafoConfigure.verbose ? '' : "$kafo_add_progress=true" end |
#append(suffix) ⇒ Object
28 29 30 31 |
# File 'lib/kafo/puppet_command.rb', line 28 def append(suffix) @suffix = suffix self end |
#command ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kafo/puppet_command.rb', line 17 def command result = [ "echo '$kafo_config_file=\"#{KafoConfigure.config_file}\" #{custom_answer_file} #{add_progress} #{@command}'", '|', "RUBYLIB=#{["#{KafoConfigure.gem_root}/modules", ENV['RUBYLIB']].join(File::PATH_SEPARATOR)}", "puppet apply #{@options.join(' ')} #{@suffix}", ].join(' ') @logger.debug result result end |
#custom_answer_file ⇒ Object
9 10 11 |
# File 'lib/kafo/puppet_command.rb', line 9 def custom_answer_file KafoConfigure.temp_config_file.nil? ? '' : "$kafo_answer_file=\"#{KafoConfigure.temp_config_file}\"" end |