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

Newly bootstrapped salt-master crashed with "ImportError: cannot import name DEFAULT_MINION_OPTS" #44435

Closed
vernondcole opened this Issue Nov 7, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@vernondcole
Contributor

vernondcole commented Nov 7, 2017

Description of Issue/Question

When attempting to bootstrap a new master using the development HEAD, I am now getting a failure
in the boot process due to an import error.

This kills an automatic provision of a Vagrant Box using Salt with a fatal error.

It also pretty well kills SaltConf presentations which are based on this code. :-(

Please note that this bug is demonstrated by a change in Salt -- not a change in bootstrap_salt.
I can make it go away by "Using Bootstrap Options: -P -M -L -D -g https://github.com/vernondcole/salt -F -c /tmp git b7c0182" as is done in the present worked-around Vagrantfile in
learn-salt project root when you use command vagrant up bevymaster.

Setup

This is documented in
learn-salt/lessons/installation
and
learn-salt/lessons/vagrant_basics

install Vagrant and Virtualbox

  • Ubuntu (and Debian and Raspbian)

    Add the plugin which keeps VBoxGuestEditions installed and up to date:

    vagrant plugin install vagrant-vbguest

Steps to Reproduce Issue

Create a Vagrantfile like:

Vagrant.configure(2) do |config|  # the literal "2" is required.
  config.vm.define "lesson1" do |quail_config|
     quail_config.vm.box = "boxesio/xenial64-standard"  # a public VMware & Virtualbox box
    quail_config.vm.hostname = "lesson1.test"
  end
end

vernoncole@vc-ddell:/projects/learn-salt/lessons/vagrant_basics$ vagrant up

Bringing machine 'lesson1' up with 'virtualbox' provider...
==> lesson1: Importing base box 'boxesio/xenial64-standard'...
==> lesson1: Matching MAC address for NAT networking...
==> lesson1: Checking if box 'boxesio/xenial64-standard' is up to date...
==> lesson1: Setting the name of the VM: vagrant_basics_lesson1_1510093882931_69824
==> lesson1: Clearing any previously set network interfaces...
==> lesson1: Preparing network interfaces based on configuration...
    lesson1: Adapter 1: nat
==> lesson1: Forwarding ports...
    lesson1: 22 (guest) => 2222 (host) (adapter 1)
==> lesson1: Booting VM...
==> lesson1: Waiting for machine to boot. This may take a few minutes...
    lesson1: SSH address: 127.0.0.1:2222
    lesson1: SSH username: vagrant
    lesson1: SSH auth method: private key
    lesson1:
    lesson1: Vagrant insecure key detected. Vagrant will automatically replace
    lesson1: this with a newly generated keypair for better security.
    lesson1:
    lesson1: Inserting generated public key within guest...
    lesson1: Removing insecure key from the guest if it's present...
    lesson1: Key inserted! Disconnecting and reconnecting using new SSH key...
==> lesson1: Machine booted and ready!
==> lesson1: Checking for guest additions in VM...
==> lesson1: Setting hostname...
==> lesson1: Mounting shared folders...
    lesson1: /vagrant => /projects/learn-salt/lessons/vagrant_basics

vernoncole@vc-ddell:/projects/learn-salt/lessons/vagrant_basics$ vagrant ssh

Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-21-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

vagrant@lesson1:~$ wget -O bootstrap_salt.sh http://bootstrap.saltstack.com

--2017-11-07 22:34:49--  http://bootstrap.saltstack.com/
Resolving bootstrap.saltstack.com (bootstrap.saltstack.com)... 198.199.77.106
Connecting to bootstrap.saltstack.com (bootstrap.saltstack.com)|198.199.77.106|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://bootstrap.saltstack.com/stable/bootstrap-salt.sh [following]
--2017-11-07 22:34:50--  https://bootstrap.saltstack.com/stable/bootstrap-salt.sh
Connecting to bootstrap.saltstack.com (bootstrap.saltstack.com)|198.199.77.106|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 256191 (250K) [application/x-sh]
Saving to: ‘bootstrap_salt.sh’

bootstrap_salt.sh                     100%[=================================================================>] 250.19K   776KB/s    in 0.3s

2017-11-07 22:34:50 (776 KB/s) - ‘bootstrap_salt.sh’ saved [256191/256191]

vagrant@lesson1:~$ sudo sh bootstrap_salt.sh -P -D -L git develop

 *  INFO: Running version: 2017.08.17
 *  INFO: Executed by: sh
 *  INFO: Command line: 'bootstrap_salt.sh -P -D -L git develop'

 *  INFO: System Information:
 *  INFO:   CPU:          GenuineIntel
 *  INFO:   CPU Arch:     x86_64
 *  INFO:   OS Name:      Linux
 *  INFO:   OS Version:   4.4.0-21-generic
 *  INFO:   Distribution: Ubuntu 16.04

 * DEBUG: Binaries will be searched using the following $PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
 *  INFO: Installing minion
 *  INFO: Installing salt-cloud and required python-libcloud package
 * DEBUG: install_ubuntu_16_git_deps not found....

. . . [ clip ] . . .

running install_egg_info
Writing /usr/lib/python2.7/dist-packages/salt-2017.7.0_792_g8ffe91f.egg-info
 *  INFO: Running install_ubuntu_git_post()
 * DEBUG: Copying /tmp/git/salt/pkg/salt-minion.service to /lib/systemd/system/salt-minion.service
disabled
Created symlink from /etc/systemd/system/multi-user.target.wants/salt-minion.service to /lib/systemd/system/salt-minion.service.
 *  INFO: Running install_ubuntu_check_services()
 * DEBUG: Checking if service salt-minion is enabled
 * DEBUG: Service salt-minion is enabled
 *  INFO: Running install_ubuntu_restart_daemons()
 * DEBUG: Waiting 3 seconds for processes to settle before checking for them
 * DEBUG: There's systemd support while checking salt-minion
 *  INFO: Running daemons_running()
 * DEBUG: Waiting 3 seconds for processes to settle before checking for them
 * ERROR: salt-minion was not found running
 * ERROR: Failed to run daemons_running()!!!
nohup: ignoring input
Traceback (most recent call last):
  File "/usr/bin/salt-minion", line 26, in <module>
    salt_minion()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 163, in salt_minion
    import salt.cli.daemons
  File "/usr/lib/python2.7/dist-packages/salt/cli/daemons.py", line 48, in <module>
    import salt.utils.parsers
  File "/usr/lib/python2.7/dist-packages/salt/utils/parsers.py", line 28, in <module>
    import salt.config as config
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 100, in <module>
    _DFLT_IPC_WBUFFER = _gather_buffer_space() * .5
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 90, in _gather_buffer_space
    import salt.grains.core
  File "/usr/lib/python2.7/dist-packages/salt/grains/core.py", line 45, in <module>
    import salt.utils.dns
  File "/usr/lib/python2.7/dist-packages/salt/utils/dns.py", line 31, in <module>
    import salt.modules.cmdmod
  File "/usr/lib/python2.7/dist-packages/salt/modules/cmdmod.py", line 34, in <module>
    import salt.utils.templates
  File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 41, in <module>
    import salt.utils.jinja
  File "/usr/lib/python2.7/dist-packages/salt/utils/jinja.py", line 30, in <module>
    import salt.fileclient
  File "/usr/lib/python2.7/dist-packages/salt/fileclient.py", line 21, in <module>
    import salt.client
  File "/usr/lib/python2.7/dist-packages/salt/client/__init__.py", line 39, in <module>
    import salt.utils.minions
  File "/usr/lib/python2.7/dist-packages/salt/utils/minions.py", line 23, in <module>
    import salt.auth.ldap
  File "/usr/lib/python2.7/dist-packages/salt/auth/__init__.py", line 32, in <module>
    import salt.utils.master
  File "/usr/lib/python2.7/dist-packages/salt/utils/master.py", line 21, in <module>
    import salt.pillar
  File "/usr/lib/python2.7/dist-packages/salt/pillar/__init__.py", line 21, in <module>
    import salt.minion
  File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 115, in <module>
    from salt.config import DEFAULT_MINION_OPTS
ImportError: cannot import name DEFAULT_MINION_OPTS
 * DEBUG: Running salt-minion by hand outputs:
 * DEBUG: /var/log/salt/minion does not exist. Can't cat its contents!

Versions Report

vernoncole@vc-ddell:/projects/learn-salt/lessons/vagrant_basics$ vagrant --version
Vagrant 2.0.0
vernoncole@vc-ddell:/projects/learn-salt/lessons/vagrant_basics$ vboxmanage --version
5.1.22_Ubuntur115126

vagrant@lessons1:~$ sudo salt --versions-report

Salt Version:
Salt: 2017.7.0-792-g8ffe91f

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.8
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.12 (default, Nov 19 2016, 06:48:10)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.2.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: Ubuntu 16.04 xenial
locale: UTF-8
machine: x86_64
release: 4.4.0-21-generic
system: Linux
version: Ubuntu 16.04 xenial

@keesbos

This comment has been minimized.

Show comment
Hide comment
@keesbos

keesbos Nov 8, 2017

Contributor

That's caused by commit 74acaad (#43703)

Contributor

keesbos commented Nov 8, 2017

That's caused by commit 74acaad (#43703)

@rallytime rallytime self-assigned this Nov 8, 2017

@rallytime rallytime added this to the Approved milestone Nov 8, 2017

rallytime added a commit to rallytime/salt that referenced this issue Nov 8, 2017

Add a late-import for the salt.utils.master.py file in salt.auth
Fixes saltstack#44435

PR saltstack#43703 inadvertently moved a "late import" statement up to the
top of the auth file, which caused the problem reported in the PR
itself and issue saltstack#44435.

Moving the salt.utils.master import lower down in the file fixes
the issue.
@rallytime

This comment has been minimized.

Show comment
Hide comment
@rallytime

rallytime Nov 8, 2017

Contributor

@vernondcole Does #44445 resolve this problem for you?

Contributor

rallytime commented Nov 8, 2017

@vernondcole Does #44445 resolve this problem for you?

@vernondcole

This comment has been minimized.

Show comment
Hide comment
@vernondcole

vernondcole Nov 10, 2017

Contributor

@rallytime Yes. Fix confirmed.

It took me a bit to figure out the bootstrap_salt.sh command line to pull the correct commit out of your repository (rather than my own or the main), but after a couple of Homer Simpson "doh" moments ... it works perfectly.

Contributor

vernondcole commented Nov 10, 2017

@rallytime Yes. Fix confirmed.

It took me a bit to figure out the bootstrap_salt.sh command line to pull the correct commit out of your repository (rather than my own or the main), but after a couple of Homer Simpson "doh" moments ... it works perfectly.

@rallytime

This comment has been minimized.

Show comment
Hide comment
@rallytime

rallytime Nov 10, 2017

Contributor

@vernondcole Excellent. Thank you for testing that, and apologies for the breakage. :)

Contributor

rallytime commented Nov 10, 2017

@vernondcole Excellent. Thank you for testing that, and apologies for the breakage. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment