provisioners/puppet: Fix Puppet environment default manifest
Also parse the puppet variables $codedir and $environment when resolving a manifest path from environment.conf
This commit is contained in:
parent
8c2dc41223
commit
f349a58a1e
|
@ -62,12 +62,16 @@ module VagrantPlugins
|
||||||
# Parse out the environment manifest path since puppet apply doesnt do that for us.
|
# 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")
|
environment_conf = File.join(environments_guest_path, @config.environment, "environment.conf")
|
||||||
if @machine.communicate.test("test -e #{environment_conf}", sudo: true)
|
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
|
if type == :stdout
|
||||||
data.each_line do |line|
|
data.each_line do |line|
|
||||||
if line =~ /^\s*manifest\s+=\s+([^\s]+)/
|
if line =~ /^\s*manifest\s+=\s+([^\s]+)/
|
||||||
@manifest_file = $1
|
@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}")
|
@logger.debug("Using manifest from environment.conf: #{@manifest_file}")
|
||||||
end
|
end
|
||||||
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.
|
# 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
|
if !@manifest_file
|
||||||
@manifest_file = "#{environments_guest_path}/#{@config.environment}/manifests/site.pp"
|
@manifest_file = "#{environments_guest_path}/#{@config.environment}/manifests"
|
||||||
parse_environment_metadata
|
parse_environment_metadata
|
||||||
end
|
end
|
||||||
# Check that the shared folders are properly shared
|
# Check that the shared folders are properly shared
|
||||||
|
|
Loading…
Reference in New Issue