Convert trigger window from string to integer

Change-Id: Iccdaea4b4e5aedd2548e865576eb718643e41cf9
This commit is contained in:
YUHAN 2018-11-30 20:18:26 +08:00
parent 262799e3c0
commit d45538cf41
1 changed files with 7 additions and 1 deletions

View File

@ -52,8 +52,14 @@ class TriggerManager(base.ManagerWithFind):
def update(self, trigger_id, data):
if data['properties'].get('window', None):
try:
data['properties']['window'] = int(
data['properties']['window'])
except Exception:
msg = 'The trigger window is not integer'
raise exceptions.CommandError(msg)
body = {"trigger_info": data}
return self._update('/triggers/{trigger_id}'
.format(trigger_id=trigger_id),
body, "trigger_info")