MCPcopy Create free account
hub / github.com/apache/cloudstack / verify_expected_rules_in_order

Function verify_expected_rules_in_order

scripts/vm/network/security_group.py:1585–1594  ·  view source on GitHub ↗
(expected_rules, rules)

Source from the content-addressed store, hash-verified

1583 return True
1584
1585def verify_expected_rules_in_order(expected_rules, rules):
1586 # Check if expected rules exist in order (!!!)
1587 i = 0
1588 for rule in rules:
1589 if i < len(expected_rules) and rule == expected_rules[i]:
1590 i += 1
1591 if i != len(expected_rules):
1592 print("Cannot find rule '%s'" % expected_rules[i])
1593 return False
1594 return True
1595
1596if __name__ == '__main__':
1597 logging.basicConfig(filename="/var/log/cloudstack/agent/security_group.log", format="%(asctime)s - %(message)s", level=logging.DEBUG)

Calls

no outgoing calls

Tested by

no test coverage detected