improved spacewalk.call return values

This commit is contained in:
Benedikt Werner 2016-10-30 11:46:34 +01:00
parent 38d9fe7134
commit 6dd1fc4429

View File

@ -183,13 +183,17 @@ def call(server_url, command, *args, **kwargs):
namespace, method = command.split('.')
endpoint = getattr(getattr(client, namespace), method)
ret = {}
try:
result = endpoint(key, *arguments)
ret['result'] = True
except Exception as e:
result = 'failed'
result = False
ret['changes'] = 'failed'
call = '{0} {1}'.format(command, arguments)
return {call: result}
ret['changes'][call] = result
return ret
def addGroupsToKey(server_url, activation_key, groups):