Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

making printing existing policy work if container group name is empty #29

Merged
merged 1 commit into from
May 23, 2023
Merged
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
11 changes: 7 additions & 4 deletions src/confcom/azext_confcom/template_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,9 @@ def get_container_group_name(
if case_insensitive_dict_get(all_params, key):
all_params[key]["value"] = case_insensitive_dict_get(
case_insensitive_dict_get(input_parameter_values_json, key), "value"
) or case_insensitive_dict_get(
) if case_insensitive_dict_get(
case_insensitive_dict_get(input_parameter_values_json, key), "value"
) is not None else case_insensitive_dict_get(
case_insensitive_dict_get(input_parameter_values_json, key),
"secureValue",
)
Expand All @@ -788,8 +790,7 @@ def get_container_group_name(
eprint(
f'Field ["{config.ACI_FIELD_TEMPLATE_PARAMETERS}"] is empty or cannot be found in Parameter file'
)
# TODO: replace this with doing param replacement as-needed
arm_json = parse_template(all_params, all_vars, arm_json)

# find the image names and extract them from the template
arm_resources = case_insensitive_dict_get(arm_json, config.ACI_FIELD_RESOURCES)

Expand All @@ -808,6 +809,7 @@ def get_container_group_name(
)

resource = aci_list[count]
resource = replace_params_and_vars(all_params, all_vars, resource)
container_group_name = case_insensitive_dict_get(resource, config.ACI_FIELD_RESOURCES_NAME)
return container_group_name

Expand All @@ -818,7 +820,8 @@ def print_existing_policy_from_arm_template(arm_template_path, parameter_data_pa
input_arm_json = os_util.load_json_from_file(arm_template_path)
parameter_data = None
if parameter_data_path:
parameter_data = os_util.load_json_from_file(arm_template_path)
parameter_data = os_util.load_json_from_file(parameter_data_path)

# find the image names and extract them from the template
arm_resources = case_insensitive_dict_get(
input_arm_json, config.ACI_FIELD_RESOURCES
Expand Down