Add safety to auth

This commit is contained in:
Thomas S Hatch 2012-10-03 23:26:24 -06:00
parent 01c3e3986b
commit 7ad4210ed1

View File

@ -40,6 +40,11 @@ class LoadAuth(object):
Return the primary name associate with the load, if an empty string Return the primary name associate with the load, if an empty string
is returned then the load does not match the function is returned then the load does not match the function
''' '''
if not 'fun' in load:
return ''
fstr = '{0}.auth'.format(load['fun'])
if not fstr in self.auth:
return ''
fcall = salt.utils.format_call(self.auth[fstr], load) fcall = salt.utils.format_call(self.auth[fstr], load)
try: try:
return fcall['args'][0] return fcall['args'][0]