Merge "Have change_alarm_state return success or failure"

This commit is contained in:
Jenkins 2014-11-12 02:38:26 +00:00 committed by Gerrit Code Review
commit d7ca6e085f
2 changed files with 6 additions and 2 deletions

View File

@ -71,7 +71,8 @@ def change_alarm_state(alarm_id, new_state):
if result_json['state'] != new_state: if result_json['state'] != new_state:
print('Alarm patch failed, expected state of %s but was %s' % print('Alarm patch failed, expected state of %s but was %s' %
(result_json['state'], new_state), file=sys.stderr) (result_json['state'], new_state), file=sys.stderr)
return 1 return False
return True
def find_alarms_for_definition(alarm_definition_id): def find_alarms_for_definition(alarm_definition_id):

View File

@ -206,7 +206,10 @@ def smoke_test(mail_host, metric_host):
new_state = 'OK' new_state = 'OK'
states.append(new_state) states.append(new_state)
cli_wrapper.change_alarm_state(alarm_id, new_state) if not cli_wrapper.change_alarm_state(alarm_id, new_state):
print('Unabled to change Alarm state', file=sys.stderr)
return False
# There is a bug in the API which allows this to work. Soon that # There is a bug in the API which allows this to work. Soon that
# will be fixed and this will fail # will be fixed and this will fail
if len(sys.argv) > 1: if len(sys.argv) > 1: