Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/confcom/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.2.9
++++++
* bugfix for --exclude-default-fragments flag not working as intended

1.2.8
++++++
* Made the default minimum SVN of the infrastructure fragment 4
Expand Down
14 changes: 9 additions & 5 deletions src/confcom/azext_confcom/security_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,13 +675,14 @@ def load_policy_from_arm_template_str(
containers = []
existing_containers = None
fragments = None
exclude_default_fragments = False
exclude_default_fragments_this_group = exclude_default_fragments

tags = case_insensitive_dict_get(resource, config.ACI_FIELD_TEMPLATE_TAGS)
if tags:
exclude_default_fragments = case_insensitive_dict_get(tags, config.ACI_FIELD_TEMPLATE_ZERO_SIDECAR)
if isinstance(exclude_default_fragments, str):
exclude_default_fragments = exclude_default_fragments.lower() == "true"
exclude_default_fragments_this_group = \
case_insensitive_dict_get(tags, config.ACI_FIELD_TEMPLATE_ZERO_SIDECAR)
if isinstance(exclude_default_fragments_this_group, str):
exclude_default_fragments_this_group = exclude_default_fragments_this_group.lower() == "true"

container_group_properties = case_insensitive_dict_get(
resource, config.ACI_FIELD_TEMPLATE_PROPERTIES
Expand Down Expand Up @@ -725,7 +726,10 @@ def load_policy_from_arm_template_str(
# In non-diff mode, we ignore the error and proceed without the policy
existing_containers, fragments = ([], [])

rego_fragments = copy.deepcopy(config.DEFAULT_REGO_FRAGMENTS) if not exclude_default_fragments else []
rego_fragments = (
copy.deepcopy(config.DEFAULT_REGO_FRAGMENTS)
if not exclude_default_fragments_this_group else []
)
if infrastructure_svn:
# assumes the first DEFAULT_REGO_FRAGMENT is always the
# infrastructure fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def test_acipolicygen(sample_directory, generated_policy_path):

for failing_sample_directory, failing_generated_policy_path in [
("multi_container_groups", "policy_fragment.rego"), # TODO: https://github.com/Azure/azure-cli-extensions/issues/9229
(None, "policy_exclude_default_fragment.rego"), # TODO: https://github.com/Azure/azure-cli-extensions/issues/9198
]:
if (
failing_sample_directory in (None, sample_directory)
Expand Down
2 changes: 1 addition & 1 deletion src/confcom/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

logger.warn("Wheel is not available, disabling bdist_wheel hook")

VERSION = "1.2.8"
VERSION = "1.2.9"

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading