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

Traceback on jobs.active #11151

Closed
clearclaw opened this issue Mar 12, 2014 · 11 comments · Fixed by #11212
Closed

Traceback on jobs.active #11151

clearclaw opened this issue Mar 12, 2014 · 11 comments · Fixed by #11212
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix help-wanted Community help is needed to resolve this

Comments

@clearclaw
Copy link

This is with 2014.1:

$ salt-run jobs.active
[ERROR ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'tgt'
Traceback (most recent call last):
File "/usr/local/bin/salt-run", line 10, in
salt_run()
File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 95, in salt_run
client.run()
File "/usr/lib/pymodules/python2.7/salt/cli/init.py", line 357, in run
runner.run()
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 219, in run
self.opts['fun'], self.opts['arg'], self.opts)
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 126, in cmd
return self.functions[fun](*args, **kwargs)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 36, in active
ret[job['jid']] = _format_job_instance(job)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 178, in _format_job_instance
'Target': job['tgt'],
KeyError: 'tgt'
Traceback (most recent call last):
File "/usr/local/bin/salt-run", line 10, in
salt_run()
File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 95, in salt_run
client.run()
File "/usr/lib/pymodules/python2.7/salt/cli/init.py", line 357, in run
runner.run()
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 219, in run
self.opts['fun'], self.opts['arg'], self.opts)
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 126, in cmd
return self.functions[fun](*args, **kwargs)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 36, in active
ret[job['jid']] = _format_job_instance(job)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 178, in _format_job_instance
'Target': job['tgt'],
KeyError: 'tgt'
$ echo "Yes, the traceback is repeated twice." > /dev/null
$ salt --versions-report
Salt: 2014.1.0
Python: 2.7.3 (default, Feb 27 2014, 19:58:35)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.4.1
PyYAML: 3.10
PyZMQ: 13.0.0
ZMQ: 3.2.2

This is under an Ubuntu 12.04.

@JustinFarris
Copy link

Even after upgrading to 2014.1.1 (and I've verified that the code is as it should be in the associated fix), I'm seeing the same behavior on ubuntu 12.04. Traceback and --versions-report are identical to above.

@cachedout
Copy link
Contributor

@JustinFarris This has already been fixed in develop. See 537f96f.

@JustinFarris
Copy link

@cachedout I see that, but as I said, even with the change listed, I'm still seeing the error.

@cachedout
Copy link
Contributor

@JustinFarris Could you please post the stacktrace that you're receiving?

@JustinFarris
Copy link

$ sudo salt-run jobs.active
[ERROR ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'tgt'
Traceback (most recent call last):
File "/usr/bin/salt-run", line 10, in
salt_run()
File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 95, in salt_run
client.run()
File "/usr/lib/pymodules/python2.7/salt/cli/init.py", line 357, in run
runner.run()
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 219, in run
self.opts['fun'], self.opts['arg'], self.opts)
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 126, in cmd
return self.functions[fun](*args, **kwargs)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 36, in active
ret[job['jid']] = _format_job_instance(job)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 186, in _format_job_instance
'Target': job['tgt'],
KeyError: 'tgt'
Traceback (most recent call last):
File "/usr/bin/salt-run", line 10, in
salt_run()
File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 95, in salt_run
client.run()
File "/usr/lib/pymodules/python2.7/salt/cli/init.py", line 357, in run
runner.run()
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 219, in run
self.opts['fun'], self.opts['arg'], self.opts)
File "/usr/lib/pymodules/python2.7/salt/runner.py", line 126, in cmd
return self.functions[fun](*args, **kwargs)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 36, in active
ret[job['jid']] = _format_job_instance(job)
File "/usr/lib/pymodules/python2.7/salt/runners/jobs.py", line 186, in _format_job_instance
'Target': job['tgt'],
KeyError: 'tgt'

$ sudo salt --versions-report
Salt: 2014.1.1
Python: 2.7.3 (default, Feb 27 2014, 19:58:35)
Jinja2: 2.6
M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.4.1
PyYAML: 3.10
PyZMQ: 13.0.0
ZMQ: 3.2.2

$ cat /usr/lib/pymodules/python2.7/salt/runners/jobs.py
#--SNIP--
def _format_job_instance(job):
return {'Function': job.get('fun', 'unknown-function'),
'Arguments': list(job.get('arg', [])),
'Target': job['tgt'],
'Target-type': job.get('tgt_type', []),
'User': job.get('user', 'root')}
#--SNIP--

@cachedout
Copy link
Contributor

Hi @JustinFarris

As mentioned before, this was fixed here.

In your snippet, you have:

'Target': job['tgt'],

Per the current HEAD, that should be:

'Target': job.get('tgt', 'unknown-target'),

This fix is not yet in any of the 2014.1 releases but it should be straightforward to change that line and hopefully eliminate the traceback that you're seeing.

@JustinFarris
Copy link

Ah, I'm a dummy. I saw one change but missed another. Sorry for the whining.

@cachedout
Copy link
Contributor

@JustinFarris No worries at all. Glad you got this resolved!

@wongster80
Copy link

Hi I'm on 2014.1.5 RPM EPEL and I'm getting this stacktrace when running salt-run jobs.active.
The fixed is in 537f96fe#diff-5ca65b130737a573488760e87b926385R179 based on what @cachedout said, but I don't see it in the 2014.1.5 code.

[ERROR ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'tgt'
Traceback (most recent call last):
File "/usr/bin/salt-run", line 10, in
salt_run()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 95, in salt_run
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/init.py", line 362, in run
runner.run()
File "/usr/lib/python2.6/site-packages/salt/runner.py", line 218, in run
self.opts['fun'], self.opts['arg'], self.opts)
File "/usr/lib/python2.6/site-packages/salt/runner.py", line 125, in cmd
return self.functions[fun](*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/runners/jobs.py", line 36, in active
ret[job['jid']] = _format_job_instance(job)
File "/usr/lib/python2.6/site-packages/salt/runners/jobs.py", line 186, in _format_job_instance
'Target': job['tgt'],
KeyError: 'tgt'
Traceback (most recent call last):
File "/usr/bin/salt-run", line 10, in
salt_run()
File "/usr/lib/python2.6/site-packages/salt/scripts.py", line 95, in salt_run
client.run()
File "/usr/lib/python2.6/site-packages/salt/cli/init.py", line 362, in run
runner.run()
File "/usr/lib/python2.6/site-packages/salt/runner.py", line 218, in run
self.opts['fun'], self.opts['arg'], self.opts)
File "/usr/lib/python2.6/site-packages/salt/runner.py", line 125, in cmd
return self.functions[fun](*args, **kwargs)
File "/usr/lib/python2.6/site-packages/salt/runners/jobs.py", line 36, in active
ret[job['jid']] = _format_job_instance(job)
File "/usr/lib/python2.6/site-packages/salt/runners/jobs.py", line 186, in _format_job_instance
'Target': job['tgt'],
KeyError: 'tgt'

From /usr/lib/python2.6/site-packages/salt/runners/jobs.py I still see 'Target': job['tgt'], did the fix get included in 2014.1.5 ?

def _format_job_instance(job):
return {'Function': job.get('fun', 'unknown-function'),
'Arguments': list(job.get('arg', [])),
'Target': job['tgt'],
'Target-type': job.get('tgt_type', []),
'User': job.get('user', 'root')}

cachedout pushed a commit to cachedout/salt that referenced this issue Jul 2, 2014
basepi added a commit that referenced this issue Jul 2, 2014
@cachedout
Copy link
Contributor

@wongster80 I submitted a PR to include the necessary fix in the upcoming release of 2014.1.6.

@yyf1986
Copy link

yyf1986 commented Jul 17, 2014

My another machine is OK.

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 fixed-pls-verify fix is linked, bug author to confirm fix help-wanted Community help is needed to resolve this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants