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

salt break of _syspaths.py #52228

Closed
alan-cugler opened this issue Mar 18, 2019 · 2 comments
Closed

salt break of _syspaths.py #52228

alan-cugler opened this issue Mar 18, 2019 · 2 comments

Comments

@alan-cugler
Copy link
Contributor

alan-cugler commented Mar 18, 2019

Issue

My salt installation is currently broken, I can't even salt --version.

Description of Issue

I have allowed updates over the last month and a half while not using salt.
Last time it worked (in February, 2019) I was working with 2018.3.3 in a deescalated user (non-root).
The salt installation is using apt updating with the proper salt repo added in to my source.list file, with the _syspaths.py file uniquely modified to a single directory for testing and git versioning.

I am assuming my salt version is 2019.2.0

Configuration

  • /usr/lib/python2.7/dist-packages/salt/_syspaths.py
# Variables overlapping between auto-generation and online tutorial
ROOT_DIR = '/home/alan-cugler/testing/Salt_training/alans-salt-experiments'
CONFIG_DIR = ROOT_DIR + '/etc/salt'
CACHE_DIR = ROOT_DIR + '/var/cache/salt'
SOCK_DIR = ROOT_DIR + '/var/run/salt'
SRV_ROOT_DIR= ROOT_DIR + '/srv'
BASE_FILE_ROOTS_DIR = ROOT_DIR + '/srv/salt'
BASE_PILLAR_ROOTS_DIR = ROOT_DIR + '/srv/pillar'
BASE_MASTER_ROOTS_DIR = ROOT_DIR + '/srv/salt-master'
LOGS_DIR = ROOT_DIR + '/var/log/salt'
PIDFILE_DIR = ROOT_DIR + '/var/run'

# Variables not present in file but were in Docs
INSTALL_DIR = None
#CLOUD_DIR = INSTALL_DIR + '/cloud'
BOOTSTRAP = '/home/alan-cugler/testing/Salt_training/bootstrap-salt.sh'

# Variables present in file but not in Docs
SHARE_DIR = None
BASE_THORIUM_ROOTS_DIR = None
SPM_FORMULA_PATH = None
SPM_PILLAR_PATH = None
SPM_REACTOR_PATH = None
HOME_DIR = None

The Error

(vENV) alan-cugler@CPC:~$ salt --versions-report
Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 511, in salt_main
    import salt.cli.salt
  File "/usr/lib/python2.7/dist-packages/salt/cli/salt.py", line 11, in <module>
    import salt.utils.job
  File "/usr/lib/python2.7/dist-packages/salt/utils/job.py", line 11, in <module>
    import salt.minion
  File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 67, in <module>
    import salt.client
  File "/usr/lib/python2.7/dist-packages/salt/client/__init__.py", line 30, in <module>
    import salt.config
  File "/usr/lib/python2.7/dist-packages/salt/config/__init__.py", line 36, in <module>
    import salt.syspaths
  File "/usr/lib/python2.7/dist-packages/salt/syspaths.py", line 78, in <module>
    SHARE_DIR = __generated_syspaths.SHARE_DIR
AttributeError: 'module' object has no attribute 'SHARE_DIR'

Related issues

@alan-cugler
Copy link
Contributor Author

Solved the issue.
The variable SPM_PARENT_PATH was added in from 2018.3.3 to 2019.2.0 though I couldn't find any mention of it from the release notes.

by adding SPM_PARENT_PATH = None salt started working again.

@guettli
Copy link
Contributor

guettli commented Apr 9, 2019

same here: I can't even salt --version.

Any reason why the pull request was not merged yet?

My traceback looks like this:

salt:/srv # salt --version
Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    sys.exit(salt_main())
  File "/usr/lib/python2.7/site-packages/salt/scripts.py", line 511, in salt_main
    import salt.cli.salt
  File "/usr/lib/python2.7/site-packages/salt/cli/salt.py", line 11, in <module>
    import salt.utils.job
  File "/usr/lib/python2.7/site-packages/salt/utils/job.py", line 11, in <module>
    import salt.minion
  File "/usr/lib/python2.7/site-packages/salt/minion.py", line 67, in <module>
    import salt.client
  File "/usr/lib/python2.7/site-packages/salt/client/__init__.py", line 30, in <module>
    import salt.config
  File "/usr/lib/python2.7/site-packages/salt/config/__init__.py", line 36, in <module>
    import salt.syspaths
  File "/usr/lib/python2.7/site-packages/salt/syspaths.py", line 127, in <module>
    SPM_PARENT_PATH = __generated_syspaths.SPM_PARENT_PATH
AttributeError: 'module' object has no attribute 'SPM_PARENT_PATH'

My change looks like this:

old:

SPM_PARENT_PATH = __generated_syspaths.SPM_PARENT_PATH

new:

SPM_PARENT_PATH = getattr(__generated_syspaths, 'SPM_PARENT_PATH', None)

.... but it leaves a bad feeling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants