From 53ddc45b3dcf732e56aba3d5ddaf0f644045cccf Mon Sep 17 00:00:00 2001 From: Silas Strawn Date: Tue, 3 May 2022 11:12:34 -0700 Subject: [PATCH] prevent using --only-show-errors, --output, -o in up --- src/containerapp/azext_containerapp/_up_utils.py | 8 +++++++- src/containerapp/azext_containerapp/custom.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/containerapp/azext_containerapp/_up_utils.py b/src/containerapp/azext_containerapp/_up_utils.py index 6c1db905238..0fef1f091c8 100644 --- a/src/containerapp/azext_containerapp/_up_utils.py +++ b/src/containerapp/azext_containerapp/_up_utils.py @@ -442,7 +442,13 @@ def _get_ingress_and_target_port(ingress, target_port, dockerfile_content: "list return ingress, target_port -def _validate_up_args(source, image, repo, registry_server): +def _validate_up_args(cmd, source, image, repo, registry_server): + disallowed_params = ["--only-show-errors", "--output", "-o"] + command_args = cmd.cli_ctx.data.get("safe_params", []) + for a in disallowed_params: + if a in command_args: + raise ValidationError(f"Argument {a} is not allowed for 'az containerapp up'") + if not source and not image and not repo: raise RequiredArgumentMissingError( "You must specify either --source, --repo, or --image" diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index 8160b7b7d10..676212133f5 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -2020,7 +2020,7 @@ def containerapp_up(cmd, HELLOWORLD = "mcr.microsoft.com/azuredocs/containerapps-helloworld" dockerfile = "Dockerfile" # for now the dockerfile name must be "Dockerfile" (until GH actions API is updated) - _validate_up_args(source, image, repo, registry_server) + _validate_up_args(cmd, source, image, repo, registry_server) validate_container_app_name(name) check_env_name_on_rg(cmd, managed_env, resource_group_name, location)