diff --git a/ceilometer/hardware/pollsters/util.py b/ceilometer/hardware/pollsters/util.py index d2f807be4..d3190d97d 100644 --- a/ceilometer/hardware/pollsters/util.py +++ b/ceilometer/hardware/pollsters/util.py @@ -41,8 +41,9 @@ def make_resource_metadata(res_metadata=None, host_url=None): def make_sample_from_host(host_url, name, sample_type, unit, volume, project_id=None, user_id=None, resource_id=None, - res_metadata=None, extra={}): + res_metadata=None, extra=None): + extra = extra or {} resource_metadata = make_resource_metadata(res_metadata, host_url) resource_metadata.update(extra) diff --git a/ceilometer/ipmi/platform/intel_node_manager.py b/ceilometer/ipmi/platform/intel_node_manager.py index 97ca0c168..000ee143f 100644 --- a/ceilometer/ipmi/platform/intel_node_manager.py +++ b/ceilometer/ipmi/platform/intel_node_manager.py @@ -103,8 +103,10 @@ NM_GET_DEVICE_ID_TEMPLATE['Last_digit_firmware_build_number'] = 1 NM_GET_DEVICE_ID_TEMPLATE['Image_flags'] = 1 -def _hex(list=[]): +def _hex(list=None): """Format the return value in list into hex.""" + + list = list or [] if list: list.reverse() return int(''.join(list), 16) diff --git a/ceilometer/ipmi/platform/ipmitool.py b/ceilometer/ipmi/platform/ipmitool.py index a222b5f03..9dd87f072 100644 --- a/ceilometer/ipmi/platform/ipmitool.py +++ b/ceilometer/ipmi/platform/ipmitool.py @@ -112,11 +112,14 @@ def _parse_output(output, template): return ret -def execute_ipmi_cmd(template={}): +def execute_ipmi_cmd(template=None): """Decorator for the execution of IPMI command. It parses the output of IPMI command into dictionary. """ + + template = template or [] + def _execute_ipmi_cmd(f): def _execute(self, **kwargs): args = ['ipmitool'] diff --git a/ceilometer/tests/api/v2/test_alarm_scenarios.py b/ceilometer/tests/api/v2/test_alarm_scenarios.py index 2481259cd..8ab13b758 100644 --- a/ceilometer/tests/api/v2/test_alarm_scenarios.py +++ b/ceilometer/tests/api/v2/test_alarm_scenarios.py @@ -628,9 +628,14 @@ class TestAlarms(v2.FunctionalTest, 'not valid for this resource', resp.json['error_message']['faultstring']) - def _do_post_alarm_invalid_action(self, ok_actions=[], alarm_actions=[], - insufficient_data_actions=[], + def _do_post_alarm_invalid_action(self, ok_actions=None, + alarm_actions=None, + insufficient_data_actions=None, error_message=None): + + ok_actions = ok_actions or [] + alarm_actions = alarm_actions or [] + insufficient_data_actions = insufficient_data_actions or [] json = { 'enabled': False, 'name': 'added_alarm',