From 89c5d8e7e677832589e935b5a5af839fc5c57a1b Mon Sep 17 00:00:00 2001 From: xinyu pang <1042945277@qq.com> Date: Sat, 7 Oct 2023 10:23:39 +0800 Subject: [PATCH] Fix AttributeError when --trigger-type is None --- src/containerapp/HISTORY.rst | 2 ++ .../azext_containerapp/containerapp_env_decorator.py | 4 ++-- .../azext_containerapp/containerapp_job_decorator.py | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index 7081ec33c70..dbc22ce3816 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -3,6 +3,8 @@ Release History =============== upcoming +++++++ +* 'az containerapp job create': Fix AttributeError when --trigger-type is None 0.3.41 ++++++ diff --git a/src/containerapp/azext_containerapp/containerapp_env_decorator.py b/src/containerapp/azext_containerapp/containerapp_env_decorator.py index c6a8dc96619..422466eb63d 100644 --- a/src/containerapp/azext_containerapp/containerapp_env_decorator.py +++ b/src/containerapp/azext_containerapp/containerapp_env_decorator.py @@ -211,10 +211,10 @@ def set_up_vnet_configuration(self): if self.get_argument_infrastructure_subnet_resource_id() or self.get_argument_docker_bridge_cidr() or self.get_argument_platform_reserved_cidr() or self.get_argument_platform_reserved_dns_ip(): vnet_config_def = VnetConfigurationModel - if self.get_argument_infrastructure_subnet_resource_id is not None: + if self.get_argument_infrastructure_subnet_resource_id() is not None: vnet_config_def["infrastructureSubnetId"] = self.get_argument_infrastructure_subnet_resource_id() - if self.get_argument_docker_bridge_cidr is not None: + if self.get_argument_docker_bridge_cidr() is not None: vnet_config_def["dockerBridgeCidr"] = self.get_argument_docker_bridge_cidr() if self.get_argument_platform_reserved_cidr() is not None: diff --git a/src/containerapp/azext_containerapp/containerapp_job_decorator.py b/src/containerapp/azext_containerapp/containerapp_job_decorator.py index 6de3f68052f..f803af56b30 100644 --- a/src/containerapp/azext_containerapp/containerapp_job_decorator.py +++ b/src/containerapp/azext_containerapp/containerapp_job_decorator.py @@ -223,7 +223,7 @@ def post_process(self, r): r = self.create() if "properties" in r and "provisioningState" in r["properties"] and r["properties"]["provisioningState"].lower() == "waiting" and not self.get_argument_no_wait(): - not self.get_argument_disable_warnings() and logger.warning('Containerapp job creation in progress. Please monitor the creation using `az containerapp job show -n {} -g {}`'.format(self.get_argument_name, self.get_argument_resource_group_name())) + not self.get_argument_disable_warnings() and logger.warning('Containerapp job creation in progress. Please monitor the creation using `az containerapp job show -n {} -g {}`'.format(self.get_argument_name(), self.get_argument_resource_group_name())) return r @@ -268,7 +268,7 @@ def construct_payload(self): manualTriggerConfig_def["parallelism"] = 0 if self.get_argument_parallelism() is None else self.get_argument_parallelism() scheduleTriggerConfig_def = None - if self.get_argument_trigger_type is not None and self.get_argument_trigger_type().lower() == "schedule": + if self.get_argument_trigger_type() is not None and self.get_argument_trigger_type().lower() == "schedule": scheduleTriggerConfig_def = ScheduleTriggerModel scheduleTriggerConfig_def[ "replicaCompletionCount"] = 0 if self.get_argument_replica_completion_count() is None else self.get_argument_replica_completion_count() @@ -276,7 +276,7 @@ def construct_payload(self): scheduleTriggerConfig_def["cronExpression"] = self.get_argument_cron_expression() eventTriggerConfig_def = None - if self.get_argument_trigger_type is not None and self.get_argument_trigger_type().lower() == "event": + if self.get_argument_trigger_type() is not None and self.get_argument_trigger_type().lower() == "event": scale_def = None if self.get_argument_min_executions() is not None or self.get_argument_max_executions() is not None or self.get_argument_polling_interval() is not None: scale_def = JobScaleModel