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

state execution stacktraces when psutil isn't installed #34043

Closed
rallytime opened this issue Jun 15, 2016 · 4 comments
Closed

state execution stacktraces when psutil isn't installed #34043

rallytime opened this issue Jun 15, 2016 · 4 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt fixed-pls-verify fix is linked, bug author to confirm fix P1 Priority 1 severity-critical top severity, seen by most users, serious issues severity-high 2nd top severity, seen by most users, causes major problems ZRELEASED - 2015.8.11 ZRELEASED - 2016.3.2
Milestone

Comments

@rallytime
Copy link
Contributor

Description of Issue/Question

Running any state, either via state.sls call or state.highstate, stacktraces when psutil isn't installed. This is due to the change in #33942. The bug is present at the HEAD of the 2015.8, 2016.3 branches currently (and will be in develop after the next merge forward).

Steps to Reproduce Issue

root@rallytime:~# salt rallytime state.sls always-changes-and-succeeds
rallytime:
    The minion function caused an exception: Traceback (most recent call last):
      File "/root/SaltStack/salt/salt/minion.py", line 1078, in _thread_return
        return_data = func(*args, **kwargs)
      File "/root/SaltStack/salt/salt/modules/state.py", line 823, in sls
        conflict = running(concurrent)
      File "/root/SaltStack/salt/salt/modules/state.py", line 122, in running
        active = __salt__['saltutil.is_running']('state.*')
      File "/root/SaltStack/salt/salt/loader.py", line 901, in __getitem__
        func = super(LazyLoader, self).__getitem__(item)
      File "/root/SaltStack/salt/salt/utils/lazy.py", line 93, in __getitem__
        raise KeyError(key)
    KeyError: 'saltutil.is_running'

OR

root@rallytime:~# salt-call --local state.highstate
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'saltutil.is_running'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/root/SaltStack/salt/salt/scripts.py", line 338, in salt_call
    client.run()
  File "/root/SaltStack/salt/salt/cli/call.py", line 53, in run
    caller.run()
  File "/root/SaltStack/salt/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/root/SaltStack/salt/salt/cli/caller.py", line 197, in call
    ret['return'] = func(*args, **kwargs)
  File "/root/SaltStack/salt/salt/modules/state.py", line 650, in highstate
    conflict = _check_queue(queue, kwargs)
  File "/root/SaltStack/salt/salt/modules/state.py", line 159, in _check_queue
    conflict = running()
  File "/root/SaltStack/salt/salt/modules/state.py", line 122, in running
    active = __salt__['saltutil.is_running']('state.*')
  File "/root/SaltStack/salt/salt/loader.py", line 901, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
  File "/root/SaltStack/salt/salt/utils/lazy.py", line 93, in __getitem__
    raise KeyError(key)
KeyError: 'saltutil.is_running'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/root/SaltStack/salt/salt/scripts.py", line 338, in salt_call
    client.run()
  File "/root/SaltStack/salt/salt/cli/call.py", line 53, in run
    caller.run()
  File "/root/SaltStack/salt/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/root/SaltStack/salt/salt/cli/caller.py", line 197, in call
    ret['return'] = func(*args, **kwargs)
  File "/root/SaltStack/salt/salt/modules/state.py", line 650, in highstate
    conflict = _check_queue(queue, kwargs)
  File "/root/SaltStack/salt/salt/modules/state.py", line 159, in _check_queue
    conflict = running()
  File "/root/SaltStack/salt/salt/modules/state.py", line 122, in running
    active = __salt__['saltutil.is_running']('state.*')
  File "/root/SaltStack/salt/salt/loader.py", line 901, in __getitem__
    func = super(LazyLoader, self).__getitem__(item)
  File "/root/SaltStack/salt/salt/utils/lazy.py", line 93, in __getitem__
    raise KeyError(key)
KeyError: 'saltutil.is_running'

Versions Report

root@rallytime:~# salt --versions
Salt Version:
           Salt: 2015.8.9-107-gf9bfcde

Dependency Versions:
         Jinja2: 2.8
       M2Crypto: 0.21.1
           Mako: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.5.0
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: 0.8.6
       cherrypy: 5.0.1
       dateutil: 2.4.2
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.10
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: 0.9.0
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 4.4.0-x86_64-linode63
         system: Ubuntu 14.04 trusty

The work-around for this bug is to install psutil.

@rallytime rallytime added Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt severity-high 2nd top severity, seen by most users, causes major problems severity-critical top severity, seen by most users, serious issues P1 Priority 1 labels Jun 15, 2016
@rallytime rallytime added this to the Approved milestone Jun 15, 2016
@meggiebot meggiebot modified the milestones: C 8, Approved Jun 15, 2016
@meggiebot
Copy link

Need to fix for 3.2 and 2015.8.11

@terminalmage
Copy link
Contributor

Is psutil a hard dep now? salt.utils.psutil_compat seems to have been clearly designed to fail with an ImportError when psutil is not present, though this psutil_compat module has been around for a while now.

@cachedout
Copy link
Contributor

Bah. Totally my fault. I think we should just amend #33942 to check for the existence of psutil and fall back to the old behavior if it isn't found. This bug is (mostly) an edge case and I'm fine with just warning the user to install psutil.

@rallytime
Copy link
Contributor Author

This is fixed in #34182. I'll close this once that is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt fixed-pls-verify fix is linked, bug author to confirm fix P1 Priority 1 severity-critical top severity, seen by most users, serious issues severity-high 2nd top severity, seen by most users, causes major problems ZRELEASED - 2015.8.11 ZRELEASED - 2016.3.2
Projects
None yet
Development

No branches or pull requests

4 participants