Bug fix while editing actions with missing keys

If a key is not present in the database, the panel failed to open the modal
windows for edition, this fix that by using the dict.get()

Change-Id: Ic5f5e216828f10d41f288408fc5109dc004c6ab9
This commit is contained in:
memo 2015-11-18 14:43:00 +00:00
parent 3c55df31d2
commit 3cce1e3d3b
2 changed files with 5 additions and 3 deletions

View File

@ -68,9 +68,10 @@ class ActionWorkflowView(workflows.WorkflowView):
self.kwargs['action_id'], json=True)
initial.update(**action['freezer_action'])
initial.update({
"mandatory": action['mandatory'],
"max_retries": action['max_retries'],
"max_retries_interval": action['max_retries_interval']
"mandatory": action.get('mandatory', None),
"max_retries": action.get('max_retries', None),
"max_retries_interval":
action.get('max_retries_interval', None)
})
initial.update({'action_id': action['action_id']})
return initial

View File

@ -388,6 +388,7 @@ class Action(object):
utils.assign_and_remove(action, action_rules, 'max_retries_interval')
utils.assign_and_remove(action, action_rules, 'mandatory')
action = utils.create_dict(**action)
action.pop('action_id', None)
action = {'freezer_action': action}
return self.client.actions.create(action)