Issue #21893 has been updated by Charlie Sharpsteen.

Status changed from Unreviewed to Rejected
Assignee set to Charlie Sharpsteen

`puppet apply` only loads the specified manifest and any manifests in the 
current working directory (there are a couple other locations that contribute, 
but Vagrant does not expose them). Prior to 1.2.3, Vagrant [would change the 
working 
directory](https://github.com/mitchellh/vagrant/blob/v1.2.2/plugins/provisioners/puppet/provisioner/puppet.rb#L95)
 to the location of the manifest being applied before executing Puppet.

In 1.2.3, a new provider option called `working_directory` was introduced that 
controlled this behavior. Unfortunately, if this option is not set, Vagrant 
does [not change directories at 
all](https://github.com/mitchellh/vagrant/blob/v1.2.3/plugins/provisioners/puppet/provisioner/puppet.rb#L116-L118)
 which means Puppet no longer finds classes and parameters defined in files 
adjacent to the file being applied.

It looks like you might be able to work around this by adding the following to 
the puppet provider block:

    puppet.working_directory = puppet.manifests_guest_path


Closing, as this is not a bug in Puppet.

----------------------------------------
Bug #21893: Puppet apply provisionning method failed
https://projects.puppetlabs.com/issues/21893#change-95333

* Author: Gilles Rosenbaum
* Status: Rejected
* Priority: Normal
* Assignee: Charlie Sharpsteen
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
Hi,

I'm using vagrant with virtualbox to test provisionning with the "puppet apply" 
method.

The following error rises when I use these commands : vagrant up or vagrant 
provision

<pre>
----
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

puppet apply -v -d --detailed-exitcodes 
/tmp/vagrant-puppet/manifests/bootstrap.pp || [ $? -eq 2 ]
----
</pre>

I'm lost because params.pp is available in my VM 
(/tmp/vagrant-puppet/manifests/provision/params.pp)

A more verbose error log is available here : 
https://gist.github.com/grosenbaum/6037989#file-error_log.

* Environment

<pre>
Host OS - Mac OSX 10.8.4
Vagrant - 1.2.3
Virtualbox - 4.2.16 r86992
Puppet  - 3.1.1
VM OS - http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box
</pre>

* My configuration

My vagrantfile is :

<pre>
box.vm.provision :puppet do |puppet|
  puppet.manifest_file  = "bootstrap.pp"
  puppet.options        = "-v -d"
end
</pre>

My bootstrap.pp is :

<pre>
# Class: bootstrap
#
#
class bootstrap
{
  include provision::params

  Exec {
    path        => "/bin/:/sbin/:/usr/bin/:/usr/sbin/:/usr/local/bin",
    environment => "HOME=/home/vagrant"
  }

  include bootstrap::update, bootstrap::upgrade, bootstrap::packages, 
bootstrap::modules
}

include bootstrap
</pre>


* My params.pp is :

<pre>
# Class: provision::params
#
#
class provision::params
{
  # Puppet variables
  $puppet_dir     = "/vagrant"
  $templates_dir  = "$puppet_dir/templates"

  # Webserver variables
  $sites_dir      = "/var/www"
  $fpm_listen     = "/var/run/php5-fpm.sock"
  $fpm_access_log = "/var/log/php5-access.log"
  $nginx_template = "nginx/vhost.php.conf.erb"

  # Database variables
  $dbuser         = "root"
  $dbpassword     = "vagrant"
  $dbconfig       = "/etc/.puppet.cnf"
}
</pre>

My Vagrant directory is :

<pre>
* Vagrantfile
* Puppetfile
* manifests/
** bootstrap.pp
** bootstrap/
*** modules.pp
*** packages.pp
*** update.pp
*** upgrade.pp
** provision/
*** params.pp
*** ...
</pre>

Any ideas ?

Thx for your help

Gilles


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to