Merge pull request #5991 from Mattias-/fix-puppet-environment-manifest
Fix puppet apply environment default manifest
This commit is contained in:
commit
7f25d49e81
|
@ -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
|
||||
|
|
|
@ -140,8 +140,9 @@ that the path is located in the "vm" at "/path/to/manifests".
|
|||
|
||||
## Environments
|
||||
|
||||
If you are using Puppet 4 or higher, you can also specify the name of the
|
||||
Puppet environment and the path on the local disk to the environment files:
|
||||
If you are using Puppet 4 or higher, you can proivision using
|
||||
[Puppet Environments](https://docs.puppetlabs.com/puppet/latest/reference/environments.html) by specifying the name of the environment and the path on the
|
||||
local disk to the environment files:
|
||||
|
||||
```ruby
|
||||
Vagrant.configure("2") do |config|
|
||||
|
@ -152,6 +153,13 @@ Vagrant.configure("2") do |config|
|
|||
end
|
||||
```
|
||||
|
||||
The default manifest is the environment's `manifests` directory.
|
||||
If the environment has an `environment.conf` the manifest path is parsed
|
||||
from there. Relative paths are assumed to be relative to the directory of
|
||||
the environment. If the manifest setting in `environment.conf` use
|
||||
the Puppet variables `$codedir` or `$environment` they are resoled to
|
||||
the parent directory of `environment_path` and `environment` respectively.
|
||||
|
||||
## Modules
|
||||
|
||||
Vagrant also supports provisioning with [Puppet modules](http://docs.puppetlabs.com/guides/modules.html).
|
||||
|
|
Loading…
Reference in New Issue