Skip to content
Merged
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.3.1
++++++
* bugfix for --exclude-default-fragments flag not working as intended

1.3.0
++++++
* Add a new --enable-stdio flag, with a warning if neither this or --disable-stdio is set
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
group_exclude_default_fragments = 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"
group_exclude_default_fragments = \
case_insensitive_dict_get(tags, config.ACI_FIELD_TEMPLATE_ZERO_SIDECAR)
if isinstance(group_exclude_default_fragments, str):
group_exclude_default_fragments = group_exclude_default_fragments.lower() == "true"

container_group_properties = case_insensitive_dict_get(
resource, config.ACI_FIELD_TEMPLATE_PROPERTIES
Expand Down Expand Up @@ -720,7 +721,10 @@ def load_policy_from_arm_template_str(
else:
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 group_exclude_default_fragments 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 @@ -54,7 +54,6 @@ def test_acipolicygen(sample_directory, generated_policy_path):

for failing_sample_directory, failing_generated_policy_paths in [
("multi_container_groups", ("policy_fragment.rego", "policy_fragment_plus_infrastructure_svn.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 (
(sample_directory == failing_sample_directory or failing_sample_directory is None)
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.3.0"
VERSION = "1.3.1"

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