From e90c36ac7718422d5804010c24f513e2ef56177e Mon Sep 17 00:00:00 2001 From: withnail Date: Thu, 2 Feb 2012 00:00:13 +0000 Subject: [PATCH] puppet_server certname changes At present, puppet_node is defined by default and must almost always be overwritten. This changes the logic for puppet_server so puppet_node is initially undefined and the node name will be set based on this order 1. puppet_node if defined 2. host_name if defined (actually this removes the explicit certname specification which is cleaner and uses the machine hostname) 3. config.vm.box --- lib/vagrant/provisioners/puppet_server.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/vagrant/provisioners/puppet_server.rb b/lib/vagrant/provisioners/puppet_server.rb index d495338bf..4621a1f72 100644 --- a/lib/vagrant/provisioners/puppet_server.rb +++ b/lib/vagrant/provisioners/puppet_server.rb @@ -12,7 +12,7 @@ module Vagrant def initialize @puppet_server = "puppet" - @puppet_node = "puppet_node" + @puppet_node = nil @options = [] end end @@ -37,14 +37,16 @@ module Vagrant options = config.options options = options.join(" ") if options.is_a?(Array) if config.puppet_node - cn = config.puppet_node + cn = "--certname #{config.puppet_node}" + elsif env[:vm].config.vm.host_name + cn = "" else - cn = env[:vm].config.vm.box + cn = "--certname #{env[:vm].config.vm.box}" end - command = "puppetd #{options} --server #{config.puppet_server} --certname #{cn}" + command = "puppetd #{options} --server #{config.puppet_server} #{cn}" - env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd") + env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd" + command) env[:vm].channel.sudo(command) do |type, data| env[:ui].info(data.chomp, :prefix => false) end