Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
Upcoming
++++++
* Fix for 'az containerapp dapr enable' cli command resulting in 'TypeError: 'NoneType' object does not support item assignment' exception.

0.3.21
++++++
* Fix the PermissionError caused for the Temporary files while running `az containerapp up` command on Windows
Expand Down
9 changes: 6 additions & 3 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2366,10 +2366,13 @@ def enable_dapr(cmd, name, resource_group_name,
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 not safe_get(containerapp_def, "properties", "configuration", "dapr"):
if "dapr" not in containerapp_def['properties']['configuration']:
safe_get(containerapp_def, "properties", "configuration", "dapr", default=[])

if dapr_app_id:
if not safe_get(containerapp_def, "properties", "configuration", "dapr", "appId"):
if dapr_app_id not in safe_get(containerapp_def['properties']['configuration']['dapr'], default=[]):
containerapp_def['properties']['configuration']['dapr']['appId'] = {}
containerapp_def['properties']['configuration']['dapr']['appId'] = dapr_app_id

if dapr_app_port:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def test_containerapp_dapr_e2e(self, resource_group):
JMESPathCheck('logLevel', "warn"),
JMESPathCheck('enableApiLogging', True),
])

self.cmd('containerapp show -g {} -n {}'.format(resource_group, ca_name), checks=[
JMESPathCheck('properties.configuration.dapr.appId', "containerapp1"),
JMESPathCheck('properties.configuration.dapr.appPort', 80),
Expand Down Expand Up @@ -649,6 +649,34 @@ def test_containerapp_dapr_e2e(self, resource_group):
JMESPathCheck('properties.configuration.dapr.enableApiLogging', True),
])

@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_up_dapr_e2e(self, resource_group):
""" Ensure that dapr can be enabled if the app has been created using containerapp up """
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'

self.cmd('configure --defaults location={}'.format(location))

image = 'mcr.microsoft.com/azuredocs/aks-helloworld:v1'
env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

create_containerapp_env(self, env_name, resource_group)

self.cmd(
'containerapp up -g {} -n {} --environment {} --image {}'.format(
resource_group, ca_name, env_name, image))

self.cmd(
'containerapp dapr enable -g {} -n {} --dapr-app-id containerapp1 --dapr-app-port 80 '
'--dapr-app-protocol http --dal --dhmrs 6 --dhrbs 60 --dapr-log-level warn'.format(
resource_group, ca_name, env_name), checks=[
JMESPathCheck('appId', "containerapp1"),
JMESPathCheck('enabled', True)
])


class ContainerappEnvStorageTests(ScenarioTest):
@AllowLargeResponse(8192)
Expand Down