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

Lower case acr names #112

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 13 additions & 0 deletions src/aosm/azext_aosm/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,19 @@ class CNFImageConfig:
source_registry_namespace: str = ""
source_local_docker_image: str = ""

def __post_init__(self):
"""
Ensure that all config is lower case.

ACR names can be uppercase but the login server is always lower case and docker
and az acr import commands require lower case. Might as well do the namespace
and docker image too although much less likely that the user has accidentally
pasted these with upper case.
"""
self.source_registry = self.source_registry.lower()
self.source_registry_namespace = self.source_registry_namespace.lower()
self.source_local_docker_image = self.source_local_docker_image.lower()

@classmethod
def helptext(cls) -> "CNFImageConfig":
"""
Expand Down
11 changes: 9 additions & 2 deletions src/aosm/azext_aosm/generate_nfd/cnf_nfd_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ def _replace_values_with_deploy_params(
"""
logger.debug("Replacing values with deploy parameters")
final_values_mapping_dict: Dict[Any, Any] = {}
for k, v in values_yaml_dict.items():
for k, v in values_yaml_dict.items(): # pylint: disable=too-many-nested-blocks
# if value is a string and contains deployParameters.
logger.debug("Processing key %s", k)
param_name = k if param_prefix is None else f"{param_prefix}_{k}"
Expand Down Expand Up @@ -764,7 +764,14 @@ def _replace_values_with_deploy_params(
final_values_mapping_dict[k].append(
self._replace_values_with_deploy_params(item, param_name)
)
elif isinstance(item, (str, int, bool)) or not v:
elif isinstance(item, (str, int, bool)) or not item:
sunnycarter marked this conversation as resolved.
Show resolved Hide resolved
if self.interactive:
if not input_ack(
"y", f"Expose parameter {param_name}? y/n "
):
logger.debug("Excluding parameter %s", param_name)
final_values_mapping_dict[k].append(item)
continue
replacement_value = f"{{deployParameters.{param_name}}}"
final_values_mapping_dict[k].append(replacement_value)
else:
Expand Down
Loading