Fix whitespace issues with puppet server
This commit is contained in:
parent
3849355ef6
commit
8daf81686d
|
@ -1,59 +1,57 @@
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module Provisioners
|
module Provisioners
|
||||||
|
class PuppetServerError < Vagrant::Errors::VagrantError
|
||||||
class PuppetServerError < Vagrant::Errors::VagrantError
|
error_namespace("vagrant.provisioners.puppet_server")
|
||||||
error_namespace("vagrant.provisioners.puppet_server")
|
|
||||||
end
|
|
||||||
|
|
||||||
class PuppetServerConfig < Vagrant::Config::Base
|
|
||||||
configures :puppet_server
|
|
||||||
|
|
||||||
attr_accessor :puppet_server
|
|
||||||
attr_accessor :puppet_node
|
|
||||||
attr_accessor :options
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
@puppet_server = "puppet"
|
|
||||||
@puppet_node = "puppet_node"
|
|
||||||
@options = []
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class PuppetServer < Base
|
|
||||||
|
|
||||||
def provision!
|
|
||||||
verify_binary("puppetd")
|
|
||||||
run_puppetd_client
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_binary(binary)
|
class PuppetServerConfig < Vagrant::Config::Base
|
||||||
vm.ssh.execute do |ssh|
|
configures :puppet_server
|
||||||
# Checks for the existence of puppetd binary and error if it
|
|
||||||
# doesn't exist.
|
attr_accessor :puppet_server
|
||||||
ssh.exec!("which #{binary}", :error_class => PuppetServerError, :_key => :puppetd_not_detected, :binary => binary)
|
attr_accessor :puppet_node
|
||||||
|
attr_accessor :options
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@puppet_server = "puppet"
|
||||||
|
@puppet_node = "puppet_node"
|
||||||
|
@options = []
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_puppetd_client
|
class PuppetServer < Base
|
||||||
options = env.config.puppet_server.options
|
def provision!
|
||||||
options = options.join(" ") if options.is_a?(Array)
|
verify_binary("puppetd")
|
||||||
if env.config.puppet_server.puppet_node
|
run_puppetd_client
|
||||||
cn = env.config.puppet_server.puppet_node
|
|
||||||
else
|
|
||||||
cn = env.config.vm.box
|
|
||||||
end
|
end
|
||||||
|
|
||||||
command = "sudo -E puppetd #{options} --server #{env.config.puppet_server.puppet_server} --certname #{cn}"
|
def verify_binary(binary)
|
||||||
|
vm.ssh.execute do |ssh|
|
||||||
|
# Checks for the existence of puppetd binary and error if it
|
||||||
|
# doesn't exist.
|
||||||
|
ssh.exec!("which #{binary}", :error_class => PuppetServerError, :_key => :puppetd_not_detected, :binary => binary)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
env.ui.info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
|
def run_puppetd_client
|
||||||
|
options = env.config.puppet_server.options
|
||||||
|
options = options.join(" ") if options.is_a?(Array)
|
||||||
|
if env.config.puppet_server.puppet_node
|
||||||
|
cn = env.config.puppet_server.puppet_node
|
||||||
|
else
|
||||||
|
cn = env.config.vm.box
|
||||||
|
end
|
||||||
|
|
||||||
vm.ssh.execute do |ssh|
|
command = "sudo -E puppetd #{options} --server #{env.config.puppet_server.puppet_server} --certname #{cn}"
|
||||||
ssh.exec!(command) do |channel, type, data|
|
|
||||||
ssh.check_exit_status(data, command) if type == :exit_status
|
env.ui.info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
|
||||||
env.ui.info("#{data}: #{type}") if type != :exit_status
|
|
||||||
|
vm.ssh.execute do |ssh|
|
||||||
|
ssh.exec!(command) do |channel, type, data|
|
||||||
|
ssh.check_exit_status(data, command) if type == :exit_status
|
||||||
|
env.ui.info("#{data}: #{type}") if type != :exit_status
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue