Skip to content
Snippets Groups Projects
Commit c2a789ad authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component:

- corrected parameters for composing config rules considering previous values
- corrected unitary test for deconfigure
parent 1dbb33d2
No related branches found
No related tags found
2 merge requests!54Release 2.0.0,!43CI pipeline and multiple module fixes
...@@ -119,6 +119,7 @@ def _raw_config_rules_to_grpc( ...@@ -119,6 +119,7 @@ def _raw_config_rules_to_grpc(
continue continue
resource_value = json.loads(resource_value) if isinstance(resource_value, str) else resource_value 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) update_config_rule_custom(device_config.config_rules, resource_key, resource_value, new_action=config_action)
return errors return errors
......
...@@ -379,7 +379,11 @@ def test_device_emulated_deconfigure( ...@@ -379,7 +379,11 @@ def test_device_emulated_deconfigure(
for config_rule in config_rules: for config_rule in config_rules:
assert config_rule.WhichOneof('config_rule') == 'custom' assert config_rule.WhichOneof('config_rule') == 'custom'
if config_rule.custom.resource_key.startswith('/endpoints/endpoint'): continue 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 if isinstance(config_rule_value, str) and config_rule_value.startswith('do_sampling (trigger:'): continue
clean_config_rules.append(config_rule) clean_config_rules.append(config_rule)
LOGGER.info('clean_config_rules = {:s}'.format(str(clean_config_rules))) LOGGER.info('clean_config_rules = {:s}'.format(str(clean_config_rules)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment