From f349a58a1e32ba68deedeca57eae1b67a8266ec3 Mon Sep 17 00:00:00 2001 From: Mattias Appelgren Date: Sat, 18 Jul 2015 13:54:58 +0200 Subject: [PATCH] provisioners/puppet: Fix Puppet environment default manifest Also parse the puppet variables $codedir and $environment when resolving a manifest path from environment.conf --- plugins/provisioners/puppet/provisioner/puppet.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index f1987dbd5..d1e124e85 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -62,12 +62,16 @@ module VagrantPlugins # Parse out the environment manifest path since puppet apply doesnt do that for us. environment_conf = File.join(environments_guest_path, @config.environment, "environment.conf") if @machine.communicate.test("test -e #{environment_conf}", sudo: true) - conf = @machine.communicate.sudo("cat #{environment_conf}") do | type, data| + @machine.communicate.sudo("cat #{environment_conf}") do | type, data| if type == :stdout data.each_line do |line| if line =~ /^\s*manifest\s+=\s+([^\s]+)/ @manifest_file = $1 - @manifest_file.gsub! '$basemodulepath:', "#{environments_guest_path}/#{@config.environment}/" + @manifest_file.gsub! "$codedir", File.dirname(environments_guest_path) + @manifest_file.gsub! "$environment", @config.environment + if !@manifest_file.start_with? "/" + @manifest_file = File.join(environments_guest_path, @config.environment, @manifest_file) + end @logger.debug("Using manifest from environment.conf: #{@manifest_file}") end end @@ -85,7 +89,7 @@ module VagrantPlugins # In environment mode we still need to specify a manifest file, if its not, use the one from env config if specified. if !@manifest_file - @manifest_file = "#{environments_guest_path}/#{@config.environment}/manifests/site.pp" + @manifest_file = "#{environments_guest_path}/#{@config.environment}/manifests" parse_environment_metadata end # Check that the shared folders are properly shared