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

Fix salt-master for old psutil #44922

Merged
merged 2 commits into from Dec 22, 2017
Merged

Conversation

dincamihai
Copy link
Contributor

What does this PR do?

Reopening PR #44885 (closed by me with a wrong rebase)

salt-master wouldn't start with old psutil version (<2) when python3 is used

Traceback (most recent call last):
  File "/usr/bin/salt-master", line 22, in <module>
    salt_master()
  File "/usr/lib/python3.4/site-packages/salt/scripts.py", line 92, in salt_master
    master.start()
  File "/usr/lib/python3.4/site-packages/salt/cli/daemons.py", line 204, in start
    super(Master, self).start()
  File "/usr/lib/python3.4/site-packages/salt/utils/parsers.py", line 1032, in start
    self.prepare()
  File "/usr/lib/python3.4/site-packages/salt/cli/daemons.py", line 184, in prepare
    import salt.master
  File "/usr/lib/python3.4/site-packages/salt/master.py", line 53, in <module>
    import salt.pillar
  File "/usr/lib/python3.4/site-packages/salt/pillar/__init__.py", line 19, in <module>
    import salt.minion
  File "/usr/lib/python3.4/site-packages/salt/minion.py", line 59, in <module>
    import salt.utils.psutil_compat as psutil
  File "/usr/lib/python3.4/site-packages/salt/utils/psutil_compat.py", line 29, in <module>
    _temp = __import__('psutil', globals(), locals(), [attr], -1)
ValueError: level must be >= 0

What issues does this PR fix or reference?

According to python documentation, import is different in PY2 and PY3

PY2: spam = __import__('spam', globals(), locals(), [], -1) https://docs.python.org/2.7/library/functions.html#__import__
PY3: spam = __import__('spam', globals(), locals(), [], 0) https://docs.python.org/3.5/library/functions.html#__import__

Tests written?

No

Commits signed with GPG?

No

@dincamihai
Copy link
Contributor Author

@rallytime please add the "Bugfix - back-port" label again.
Sorry for closing the initial PR.
Thanks!

@rallytime rallytime added the bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch label Dec 11, 2017
@rallytime
Copy link
Contributor

re-run py3

@rallytime rallytime merged commit 0f8f507 into saltstack:develop Dec 22, 2017
@rallytime rallytime added ZZZ[Done]-back-ported-bf RETIRED The pull request has been back-ported to an older branch. and removed bugfix-bckport will be be back-ported to an older release branch by creating a PR against that branch labels Dec 27, 2017
rallytime pushed a commit that referenced this pull request Dec 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ZZZ[Done]-back-ported-bf RETIRED The pull request has been back-ported to an older branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants