Be a bit more robust when parsing environment.conf

This commit is contained in:
Ben Hines 2015-04-27 23:09:07 -07:00
parent 602227ca7d
commit 9bbfbef977
1 changed files with 7 additions and 4 deletions

View File

@ -57,14 +57,17 @@ module VagrantPlugins
end
def parse_environment_metadata
# 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|
if type == :stdout
# Parse out the environment manifest path since puppet apply doesnt do that for us.
if data =~ /\s+manifest\s+=\s(.*)/
@manifest_file = $1
@manifest_file.gsub! '$basemodulepath:', "#{environments_guest_path}/#{@config.environment}/"
data.each_line do |line|
if line =~ /^\s*manifest\s+=\s+([^\s]+)/
@manifest_file = $1
@manifest_file.gsub! '$basemodulepath:', "#{environments_guest_path}/#{@config.environment}/"
@logger.debug("Using manifest from environment.conf: #{@manifest_file}")
end
end
end
end