Class: Toft::Puppet::PuppetRunner

Inherits:
Object
  • Object
show all
Includes:
FileUtils
Defined in:
lib/toft/puppet/puppet_runner.rb

Constant Summary collapse

DEST_PUPPET_TMP =
"/tmp/toft-puppet-tmp"
DEST_CONF_PATH =
"/etc/puppet/puppet.conf"

Instance Method Summary collapse

Constructor Details

#initialize(root_dir, &command_runner) ⇒ PuppetRunner

Returns a new instance of PuppetRunner.



11
12
13
14
# File 'lib/toft/puppet/puppet_runner.rb', line 11

def initialize(root_dir, &command_runner)
  @root_dir = root_dir
  @command_runner = command_runner
end

Instance Method Details

#run(run_list, params = {}) ⇒ Object



16
17
18
19
20
# File 'lib/toft/puppet/puppet_runner.rb', line 16

def run(run_list, params = {})
  copy_puppet_material
  copy_conf_file(params[:conf_file]) if params[:conf_file]
  @command_runner.call "puppet apply #{DEST_PUPPET_TMP}/#{run_list}"
end