Class: Vagrant::Provisioners::PuppetServer
- Inherits:
-
Base
- Object
- Base
- Vagrant::Provisioners::PuppetServer
show all
- Defined in:
- lib/vagrant/provisioners/puppet_server.rb
Defined Under Namespace
Classes: Config
Instance Attribute Summary
Attributes inherited from Base
#config, #env
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#cleanup, #initialize, #prepare
Class Method Details
.config_class ⇒ Object
19
20
21
|
# File 'lib/vagrant/provisioners/puppet_server.rb', line 19
def self.config_class
Config
end
|
Instance Method Details
#provision! ⇒ Object
23
24
25
26
|
# File 'lib/vagrant/provisioners/puppet_server.rb', line 23
def provision!
verify_binary("puppet")
run_puppet_agent
end
|
#run_puppet_agent ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/vagrant/provisioners/puppet_server.rb', line 35
def run_puppet_agent
options = config.options
options = [options] if !options.is_a?(Array)
cn = nil
if config.puppet_node
cn = config.puppet_node
elsif env[:vm].config.vm.host_name
cn = nil
else
cn = env[:vm].config.vm.box
end
options += ["--certname", cn] if cn
options = options.join(" ")
facter = ""
if !config.facter.empty?
facts = []
config.facter.each do |key, value|
facts << "FACTER_#{key}='#{value}'"
end
facter = "#{facts.join(" ")} "
end
command = "#{facter}puppet agent #{options} --server #{config.puppet_server} --detailed-exitcodes || [ $? -eq 2 ]"
env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
env[:vm].channel.sudo(command) do |type, data|
env[:ui].info(data.chomp, :prefix => false)
end
end
|
#verify_binary(binary) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/vagrant/provisioners/puppet_server.rb', line 28
def verify_binary(binary)
env[:vm].channel.sudo("which #{binary}",
:error_class => PuppetServerError,
:error_key => :not_detected,
:binary => binary)
end
|