Properly parse out and use the environment's manifest file which is specified in environment.con.

This commit is contained in:
Ben Hines 2015-04-12 02:16:54 -07:00
parent c8f300e5f5
commit b40426aca5
1 changed files with 7 additions and 8 deletions

View File

@ -56,23 +56,20 @@ module VagrantPlugins
end end
end end
# For convenience, add in any module_paths from the Puppet environment.cfg to the vagrant module_paths
# This is needed because puppet apply does not read environment metadata (as of v3.6)
def parse_environment_metadata def parse_environment_metadata
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| conf = @machine.communicate.sudo("cat #{environment_conf}") do | type, data|
if type == :stdout if type == :stdout
#modulepath = $basemodulepath:modules/private:modules/public # Parse out the environment manifest path since puppet apply doesnt do that for us.
puts "got line #{data}" if data =~ /\s+manifest\s+=\s(.*)/
@environment_manifest_path = $1
@environment_manifest_path.gsub! '$basemodulepath:', "#{environments_guest_path}/#{@config.environment}/"
end
end end
end end
puts "Found an environment cfg at: #{environment_conf} - #{conf}"
else
puts "env cfg not found, looked for #{environment_conf}"
end end
end end
def provision def provision
# If the machine has a wait for reboot functionality, then # If the machine has a wait for reboot functionality, then
@ -87,6 +84,7 @@ module VagrantPlugins
check << manifests_guest_path check << manifests_guest_path
end end
if @config.environment_path.is_a?(Array) && @config.environment_path[0] == :host if @config.environment_path.is_a?(Array) && @config.environment_path[0] == :host
@environment_manifest_path = "#{environments_guest_path}/#{@config.environment}/manifests/site.pp"
check << environments_guest_path check << environments_guest_path
end end
@module_paths.each do |host_path, guest_path| @module_paths.each do |host_path, guest_path|
@ -183,6 +181,7 @@ module VagrantPlugins
options << "--detailed-exitcodes" options << "--detailed-exitcodes"
if config.environment_path if config.environment_path
options << " #{@environment_manifest_path}"
options << "--environmentpath #{environments_guest_path}/" options << "--environmentpath #{environments_guest_path}/"
options << "--environment #{@config.environment}" options << "--environment #{@config.environment}"
else else