diff --git a/src/device/service/Tools.py b/src/device/service/Tools.py index 28b5391a7b19b9e64a37504b8a95e61aa6db1d72..970a35e37eddd2ff6221d1c5593f5a87d718925d 100644 --- a/src/device/service/Tools.py +++ b/src/device/service/Tools.py @@ -119,6 +119,7 @@ def _raw_config_rules_to_grpc( continue resource_value = json.loads(resource_value) if isinstance(resource_value, str) else resource_value + resource_value = {field_name : (field_value, False) for field_name,field_value in resource_value.items()} update_config_rule_custom(device_config.config_rules, resource_key, resource_value, new_action=config_action) return errors diff --git a/src/device/tests/test_unitary_emulated.py b/src/device/tests/test_unitary_emulated.py index 1af1ad8613aef3d38819a5a4ffdafbe8ec519945..0e5f8e22de07cd53278b15ca3203661b27881472 100644 --- a/src/device/tests/test_unitary_emulated.py +++ b/src/device/tests/test_unitary_emulated.py @@ -379,7 +379,11 @@ def test_device_emulated_deconfigure( for config_rule in config_rules: assert config_rule.WhichOneof('config_rule') == 'custom' if config_rule.custom.resource_key.startswith('/endpoints/endpoint'): continue - config_rule_value = json.loads(config_rule.custom.resource_value) + if config_rule.custom.resource_key.startswith('_connect/'): continue + try: + config_rule_value = json.loads(config_rule.custom.resource_value) + except: # pylint: disable=bare-except + config_rule_value = config_rule.custom.resource_value if isinstance(config_rule_value, str) and config_rule_value.startswith('do_sampling (trigger:'): continue clean_config_rules.append(config_rule) LOGGER.info('clean_config_rules = {:s}'.format(str(clean_config_rules)))