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:
Jeff Schroeder 2011-12-01 22:39:59 -08:00
parent 10d37cec2a
commit 68e8088e31

View File

@ -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):