Set default of dimensions parameter to be empty dict

This commit is contained in:
Rob 2015-10-07 13:54:00 +11:00
parent 3a9d046f96
commit ca517abf07

View file

@ -184,7 +184,7 @@ def create_metric_alarm(connection, module):
comparisons = {'<=' : 'LessThanOrEqualToThreshold', '<' : 'LessThanThreshold', '>=' : 'GreaterThanOrEqualToThreshold', '>' : 'GreaterThanThreshold'} comparisons = {'<=' : 'LessThanOrEqualToThreshold', '<' : 'LessThanThreshold', '>=' : 'GreaterThanOrEqualToThreshold', '>' : 'GreaterThanThreshold'}
alarm.comparison = comparisons[comparison] alarm.comparison = comparisons[comparison]
dim1 = module.params.get('dimensions', {}) dim1 = module.params.get('dimensions')
dim2 = alarm.dimensions dim2 = alarm.dimensions
for keys in dim1: for keys in dim1:
@ -255,7 +255,7 @@ def main():
unit=dict(type='str', choices=['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', 'Count', 'Bytes/Second', 'Kilobytes/Second', 'Megabytes/Second', 'Gigabytes/Second', 'Terabytes/Second', 'Bits/Second', 'Kilobits/Second', 'Megabits/Second', 'Gigabits/Second', 'Terabits/Second', 'Count/Second', 'None']), unit=dict(type='str', choices=['Seconds', 'Microseconds', 'Milliseconds', 'Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes', 'Bits', 'Kilobits', 'Megabits', 'Gigabits', 'Terabits', 'Percent', 'Count', 'Bytes/Second', 'Kilobytes/Second', 'Megabytes/Second', 'Gigabytes/Second', 'Terabytes/Second', 'Bits/Second', 'Kilobits/Second', 'Megabits/Second', 'Gigabits/Second', 'Terabits/Second', 'Count/Second', 'None']),
evaluation_periods=dict(type='int'), evaluation_periods=dict(type='int'),
description=dict(type='str'), description=dict(type='str'),
dimensions=dict(type='dict'), dimensions=dict(type='dict', default={}),
alarm_actions=dict(type='list'), alarm_actions=dict(type='list'),
insufficient_data_actions=dict(type='list'), insufficient_data_actions=dict(type='list'),
ok_actions=dict(type='list'), ok_actions=dict(type='list'),