Class: Vagrant::Provisioners::PuppetServer

Inherits:
Base
  • Object
show all
Defined in:
lib/vagrant/provisioners/puppet_server.rb

Defined Under Namespace

Classes: Config

Instance Attribute Summary

Attributes inherited from Base

#action_env, #config

Instance Method Summary collapse

Methods inherited from Base

#cleanup, #env, #initialize, #prepare, register, registered, #vm

Constructor Details

This class inherits a constructor from Vagrant::Provisioners::Base

Instance Method Details

#provision!Object



22
23
24
25
# File 'lib/vagrant/provisioners/puppet_server.rb', line 22

def provision!
  verify_binary("puppetd")
  run_puppetd_client
end

#run_puppetd_clientObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vagrant/provisioners/puppet_server.rb', line 33

def run_puppetd_client
  options = config.options
  options = options.join(" ") if options.is_a?(Array)
  if config.puppet_node
    cn = config.puppet_node
  else
    cn = env.config.vm.box
  end

  commands = "puppetd #{options} --server #{config.puppet_server} --certname #{cn}"

  env.ui.info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")

  vm.ssh.execute do |ssh|
    ssh.sudo!(commands) do |channel, type, data|
      ssh.check_exit_status(data, commands) if type == :exit_status
      env.ui.info(data) if type != :exit_status
    end
  end
end

#verify_binary(binary) ⇒ Object



27
28
29
30
31
# File 'lib/vagrant/provisioners/puppet_server.rb', line 27

def verify_binary(binary)
  vm.ssh.execute do |ssh|
    ssh.sudo!("which #{binary}", :error_class => PuppetServerError, :_key => :puppetd_not_detected, :binary => binary)
  end
end