From f1575dd2ce705e51d5e62ab9a3c0dbc4508a835d Mon Sep 17 00:00:00 2001 From: Haroon Feisal Date: Tue, 22 Mar 2022 15:30:41 -0400 Subject: [PATCH 1/2] Updated dapr enable/disable to current spec. --- src/containerapp/azext_containerapp/custom.py | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index a5d40c3c2d9..f8e09e46b00 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -1835,19 +1835,22 @@ def enable_dapr(cmd, name, resource_group_name, dapr_app_id=None, dapr_app_port= _get_existing_secrets(cmd, resource_group_name, name, containerapp_def) - if 'dapr' not in containerapp_def['properties']: - containerapp_def['properties']['dapr'] = {} + if 'configuration' not in containerapp_def['properties']: + containerapp_def['properties']['configuration'] = {} + + if 'dapr' not in containerapp_def['properties']['configuration']: + containerapp_def['properties']['configuration']['dapr'] = {} if dapr_app_id: - containerapp_def['properties']['dapr']['dapr_app_id'] = dapr_app_id + containerapp_def['properties']['configuration']['dapr']['dapr_app_id'] = dapr_app_id if dapr_app_port: - containerapp_def['properties']['dapr']['dapr_app_port'] = dapr_app_port + containerapp_def['properties']['configuration']['dapr']['dapr_app_port'] = dapr_app_port if dapr_app_protocol: - containerapp_def['properties']['dapr']['dapr_app_protocol'] = dapr_app_protocol + containerapp_def['properties']['configuration']['dapr']['dapr_app_protocol'] = dapr_app_protocol - containerapp_def['properties']['dapr']['enabled'] = True + containerapp_def['properties']['configuration']['dapr']['enabled'] = True try: r = ContainerAppClient.create_or_update( @@ -1871,7 +1874,13 @@ def disable_dapr(cmd, name, resource_group_name, no_wait=False): _get_existing_secrets(cmd, resource_group_name, name, containerapp_def) - containerapp_def['properties']['dapr']['enabled'] = False + if 'configuration' not in containerapp_def['properties']: + containerapp_def['properties']['configuration'] = {} + + if 'dapr' not in containerapp_def['properties']['configuration']: + containerapp_def['properties']['configuration']['dapr'] = {} + + containerapp_def['properties']['configuration']['dapr']['enabled'] = False try: r = ContainerAppClient.create_or_update( From f239d8ddc327dcb4a4300ae3d49c35de5121f06f Mon Sep 17 00:00:00 2001 From: Haroon Feisal Date: Tue, 22 Mar 2022 16:10:17 -0400 Subject: [PATCH 2/2] Fixed oversight. --- src/containerapp/azext_containerapp/custom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index f8e09e46b00..b3876e88f38 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -1855,7 +1855,7 @@ def enable_dapr(cmd, name, resource_group_name, dapr_app_id=None, dapr_app_port= 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) - return r["properties"]['dapr'] + return r["properties"]['configuration']['dapr'] except Exception as e: handle_raw_exception(e) @@ -1885,7 +1885,7 @@ def disable_dapr(cmd, name, resource_group_name, no_wait=False): 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) - return r["properties"]['dapr'] + return r["properties"]['configuration']['dapr'] except Exception as e: handle_raw_exception(e)