From 37030adc542ab3e38264b29a01b284e29479f716 Mon Sep 17 00:00:00 2001 From: Haroon Feisal Date: Wed, 23 Mar 2022 12:26:37 -0400 Subject: [PATCH] Fixed dapr in create. --- src/containerapp/azext_containerapp/custom.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index 5f354d81960..44a8f05cfc5 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -256,6 +256,11 @@ def create_containerapp_yaml(cmd, name, resource_group_name, file_name, no_wait= name, resource_group_name )) + if "ingress" in containerapp_def["properties"]["configuration"] and "fqdn" in containerapp_def["properties"]["configuration"]["ingress"]: + logger.warning("\nContainer app created. Access your app at https://{}/\n".format(r["properties"]["configuration"]["ingress"]["fqdn"])) + else: + logger.warning("\nContainer app created. To access it over HTTPS, enable ingress: az containerapp ingress enable --help\n") + return r except Exception as e: handle_raw_exception(e) @@ -420,10 +425,11 @@ def create_containerapp(cmd, dapr_def["appPort"] = dapr_app_port dapr_def["appProtocol"] = dapr_app_protocol + config_def["dapr"] = dapr_def + template_def = TemplateModel template_def["containers"] = [container_def] template_def["scale"] = scale_def - template_def["dapr"] = dapr_def if revision_suffix is not None: template_def["revisionSuffix"] = revision_suffix @@ -442,7 +448,10 @@ def create_containerapp(cmd, if "properties" in r and "provisioningState" in r["properties"] and r["properties"]["provisioningState"].lower() == "waiting" and not no_wait: logger.warning('Containerapp creation in progress. Please monitor the creation using `az containerapp show -n {} -g {}`'.format(name, resource_group_name)) - + if ingress is not None and target_port is not None: + logger.warning("\nContainer app created. Access your app at https://{}/\n".format(r["properties"]["configuration"]["ingress"]["fqdn"])) + else: + logger.warning("\nContainer app created. To access it over HTTPS, enable ingress: az containerapp ingress enable --help\n") return r except Exception as e: handle_raw_exception(e) @@ -740,6 +749,7 @@ def create_managed_environment(cmd, if "properties" in r and "provisioningState" in r["properties"] and r["properties"]["provisioningState"].lower() == "waiting" and not no_wait: logger.warning('Containerapp environment creation in progress. Please monitor the creation using `az containerapp env show -n {} -g {}`'.format(name, resource_group_name)) + logger.warning("\nContainer Apps environment created. To deploy a container app, use: az containerapp create --help\n") return r except Exception as e: handle_raw_exception(e) @@ -1467,6 +1477,7 @@ def enable_ingress(cmd, name, resource_group_name, type, target_port, transport= try: r = ContainerAppClient.create_or_update( cmd=cmd, resource_group_name=resource_group_name, name=name, container_app_envelope=containerapp_def, no_wait=no_wait) + logger.warning("\nIngress enabled. Access your app at https://{}/\n".format(r["properties"]["configuration"]["ingress"]["fqdn"])) return r["properties"]["configuration"]["ingress"] except Exception as e: handle_raw_exception(e) @@ -1848,13 +1859,13 @@ def enable_dapr(cmd, name, resource_group_name, dapr_app_id=None, dapr_app_port= containerapp_def['properties']['dapr'] = {} if dapr_app_id: - containerapp_def['properties']['dapr']['dapr_app_id'] = dapr_app_id + containerapp_def['properties']['dapr']['appId'] = dapr_app_id if dapr_app_port: - containerapp_def['properties']['dapr']['dapr_app_port'] = dapr_app_port + containerapp_def['properties']['dapr']['appPort'] = dapr_app_port if dapr_app_protocol: - containerapp_def['properties']['dapr']['dapr_app_protocol'] = dapr_app_protocol + containerapp_def['properties']['dapr']['appProtocol'] = dapr_app_protocol containerapp_def['properties']['dapr']['enabled'] = True