mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Fix 2 tracebacks in salt-call
root@desktopmonster:/home/jeff/git/salt/salt/grains# salt-call grains.bogus Function grains.itez is not available Traceback (most recent call last): File "/home/jeff/git/salt/scripts/salt-call", line 18, in <module> main() File "/home/jeff/git/salt/scripts/salt-call", line 15, in main client.run() File "/home/jeff/git/salt/salt/cli/__init__.py", line 567, in run caller.run() File "/home/jeff/git/salt/salt/cli/caller.py", line 95, in run ret = self.call() File "/home/jeff/git/salt/salt/cli/caller.py", line 35, in call ret['return'] = self.minion.functions[self.opts['fun']]( KeyError: 'grains.bogus' root@desktopmonster:/home/jeff/git/salt/salt/grains# salt-call grains.item DEBUG: fun=grains.item arg=[] Traceback (most recent call last): File "/home/jeff/git/salt/scripts/salt-call", line 18, in <module> main() File "/home/jeff/git/salt/scripts/salt-call", line 15, in main client.run() File "/home/jeff/git/salt/salt/cli/__init__.py", line 567, in run caller.run() File "/home/jeff/git/salt/salt/cli/caller.py", line 91, in run ret = self.call() File "/home/jeff/git/salt/salt/cli/caller.py", line 35, in call *self.opts['arg'] TypeError: item() takes exactly 1 argument (0 given)
This commit is contained in:
parent
10d37cec2a
commit
68e8088e31
@ -4,7 +4,7 @@ minion modules.
|
||||
'''
|
||||
|
||||
# Import python modules
|
||||
import pprint
|
||||
import sys
|
||||
|
||||
# Import salt libs
|
||||
import salt
|
||||
@ -30,10 +30,15 @@ class Caller(object):
|
||||
'''
|
||||
ret = {}
|
||||
if self.opts['fun'] not in self.minion.functions:
|
||||
print 'Function {0} is not available'.format(self.opts['fun'])
|
||||
ret['return'] = self.minion.functions[self.opts['fun']](
|
||||
*self.opts['arg']
|
||||
)
|
||||
sys.stderr.write('Function {0} is not available\n'.format(self.opts['fun']))
|
||||
sys.exit(1)
|
||||
try:
|
||||
ret['return'] = self.minion.functions[self.opts['fun']](
|
||||
*self.opts['arg']
|
||||
)
|
||||
except TypeError, exc:
|
||||
sys.stderr.write('Error running \'{0}\': {1}\n'.format(self.opts['fun'], str(exc)))
|
||||
sys.exit(1)
|
||||
if hasattr(self.minion.functions[self.opts['fun']], '__outputter__'):
|
||||
oput = self.minion.functions[self.opts['fun']].__outputter__
|
||||
if isinstance(oput, str):
|
||||
|
Loading…
Reference in New Issue
Block a user