Skip to content

Commit

Permalink
Merge branch 'hotfix' into 'master'
Browse files Browse the repository at this point in the history
HOTFIX

See merge request arenadata/development/adcm!3080
  • Loading branch information
a-alferov committed Oct 10, 2023
2 parents 3996d81 + fc6a2e2 commit 2d81344
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/cm/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def match_list(data, rules, rule, path, parent=None):
def match_dict(data, rules, rule, path, parent=None):
check_match_type("match_dict", data, dict, path, rule, parent)

if "required_items" in rules[rule] or "invisible_items" in rules[rule]:
for i in rules[rule].get("required_items", []) + rules[rule].get("invisible_items", []):
if "required_items" in rules[rule]:
for i in rules[rule].get("required_items", []):
if i not in data:
raise FormatError(path, f'There is no required key "{i}" in map.', data, rule)

Expand Down
2 changes: 1 addition & 1 deletion python/cm/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get_before_upgrade(obj: ADCMEntity, host: Host | None) -> dict:
name=obj_prototype.name, parent__name=obj_prototype.parent.name, bundle_id=bundle_id
)
else:
old_proto = Prototype.objects.get(name=obj_prototype.name, bundle_id=bundle_id)
old_proto = Prototype.objects.get(name=obj_prototype.name, bundle_id=bundle_id, parent=None)

except Prototype.DoesNotExist:
logger.info("Can't get old proto for %s. Old bundle id: %s", obj, bundle_id)
Expand Down
5 changes: 2 additions & 3 deletions python/cm/tests/test_yaml_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ class TestYAMLChecker(TestCase):
def test_initial_data_correct_success(self):
process_rule(data=test_data, rules=test_rules, name="root")

def test_invisible_field_not_in_data_fail(self):
def test_invisible_field_not_in_data_success(self):
rules = deepcopy(test_rules)
rules["replica_item"]["invisible_items"].append("non_existent_field")
with self.assertRaises(FormatError):
process_rule(data=test_data, rules=rules, name="root")
process_rule(data=test_data, rules=rules, name="root")

def test_invisible_items_in_match_none_fail(self):
rules = deepcopy(test_rules)
Expand Down

0 comments on commit 2d81344

Please sign in to comment.