Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Salt provisioning fails when box is already provisioned #6011

Closed
mpolden opened this issue Jul 20, 2015 · 14 comments
Closed

Regression: Salt provisioning fails when box is already provisioned #6011

mpolden opened this issue Jul 20, 2015 · 14 comments

Comments

@mpolden
Copy link

mpolden commented Jul 20, 2015

When running vagrant provision on a box that has already been provisioned once, it fails with the following error:

$ vagrant provision
==> default: Running provisioner: salt...
Copying salt minion config to vm.
Checking if salt-minion is installed
salt-minion found
Checking if salt-call is installed
salt-call found
Salt binaries found. Configuring only.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/tmp/bootstrap_salt.sh  -C

Stdout from the command:



Stderr from the command:

stdin: is not a tty
 * ERROR: In order to run the script in configuration only mode you also need to provide the configuration directory.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IOError: [Errno 32] Broken pipe

Looks like the bootstrap_salt.sh script requires -c to be given when running in configuration-only mode (-C).

Minimal Vagrantfile to reproduce:

Vagrant.configure("2") do |config|
  config.vm.box = "chef/ubuntu-14.04"
  config.vm.synced_folder ".", "/vagrant"
  config.vm.provision :salt do |salt|
    salt.minion_config = "salt/minion.yml"
    salt.run_highstate = true
  end
end

Vagrant version: 1.7.4

@mpolden
Copy link
Author

mpolden commented Jul 20, 2015

This seems to be a regression as it works fine on 1.7.2:

$ vagrant provision
==> default: Running provisioner: salt...
Copying salt minion config to vm.
Checking if salt-minion is installed
salt-minion found
Checking if salt-call is installed
salt-call found
Using Bootstrap Options:  -F -c /tmp -C
Salt binaries found. Configuring only.
stdin: is not a tty
<snip>

Notice the different bootstrap options: -F -c /tmp -C

@Vanav
Copy link

Vanav commented Jul 24, 2015

Is this syntax correct?

        if configure && !@machine.config.vm.communicator == :winrm
          options = "%s -F -c %s" % [options, config_dir]
        end

It seems that !(...) is missing or something like this, and "-c" is never added.
4b217e2#diff-c4526b51e4e1b1f3f6bff789181cce2b

@mpolden
Copy link
Author

mpolden commented Jul 25, 2015

If that's the case, why not just change the condition to != instead?

@mpolden mpolden changed the title Salt provisioning fails when box is already provisioned Regression: Salt provisioning fails when box is already provisioned Jul 25, 2015
@howardroark
Copy link

I can confirm that this happens only with 1.7.3 as well (on both Windows and OSX). If Salt is installed at all things fall over when trying to provision. @martinp Did you manage to find any work arounds?

This issue makes it really difficult to work with Salt, and it would be awesome if it could be patched quickly somehow. Virtualbox is pushing v5 now and it will be hard to coordinate for people to use the old versions of both Virtualbox and Vagrant in the mean time.

Thanks!

@mpolden
Copy link
Author

mpolden commented Aug 3, 2015

@howardroark No. I just reverted to 1.7.2.

@howardroark
Copy link

As an alternative you can always do...

config.vm.provision :shell, path: 'https://raw.githubusercontent.com/saltstack/salt-bootstrap/stable/bootstrap-salt.sh', :args => ""
config.vm.provision :file, source: 'salt/minion', destination: '/etc/salt/minion'
config.vm.provision :shell, inline: 'sudo salt-call state.highstate'

The Salt bootstrap script runs every time but it is pretty quick when all the deps are in place.

@teiresias
Copy link

You need to specify a configuration directory like this:

salt.bootstrap_options = "-c /tmp"

See bootstrap_salt.sh options...

@darkn3rd
Copy link

My snippet that reproduces this, experimenting with workarounds suggested.

  config.vm.provision :salt do |salt|
    salt.run_highstate = true
    salt.verbose = true
  end

But I still get the following:

DEBUG ssh: Re-using SSH connection.
 INFO ssh: Execute: /tmp/bootstrap_salt.sh  -C (sudo=true)
DEBUG ssh: stderr:  

@darkn3rd
Copy link

Alright, due to bug #6029, with Ubuntu Precise 12.04, you need to do the following to work around this issue:

  config.vm.provision :salt do |salt|
    # ... 
    salt.bootstrap_options = "-F -c /tmp -P"      # Vagrant Issues #6011, #6029
    # ...
  end

I haven't tested if -F is exactly needed, but using comments regarding Vagrant 1.7.2 behavior, figured it was good to keep it in there. The -P is required for Ubuntu, as bootstrap.sh uses pip to install Tornado. The -P is NOT needed for Cent OS 6.6 and Debian Wheezy.

@robob4him
Copy link

+1, da67824 clobbered our salt setup
Thanks @darkn3rd, I'll see if that works for us till this pushes through with a version.

@bensimian
Copy link

When I use the bootstrap options solution i keep getting an error that says the F flag does not exist.
It's unfortunate as both of our developers have the same version of vagrant one needs this fix and the other does not. Any ideas?

@bensimian
Copy link

Hi thanks Howard. We did exactly what you said. Removed the preinstalled
salt plugin and it worked across. Much appreciated!

On Thu, Sep 24, 2015 at 5:34 PM, Howard Roark notifications@github.com
wrote:

Hey @ibenschop https://github.com/ibenschop ... If you can switch to a
base Vagrant box without Salt pre-installed you should be able to loose the
-F flag. You will need -P for Ubuntu to enable pip installation.

Here are some options...
https://atlas.hashicorp.com/boxes/search?utm_source=vagrantcloud.com&vagrantcloud=1


Reply to this email directly or view it on GitHub
#6011 (comment).

filipposc5 added a commit to ministryofjustice/logstash-formula that referenced this issue Sep 25, 2015
After vagrant 1.7.2 the salt provisioner seems to misbehave:
hashicorp/vagrant#6011
and
hashicorp/vagrant#6029
@mitchellh
Copy link
Contributor

I believe a fix is in with the latest PR merges. Please verify with Vagrant 1.8 and if the issue persist please reopen. Thanks!

@pkruithof
Copy link

It's not resolved for me when using Vagrant 1.8.1, same error as in #6029

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants