Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PATCH API for containerapp update. #129

Merged
merged 22 commits into from
Jul 15, 2022
Merged
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
2 changes: 1 addition & 1 deletion src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Release History

0.3.8
++++++
* TODO
* Fixed bug with 'az containerapp update' where --yaml would error out due to secret values

0.3.7
++++++
Expand Down
31 changes: 30 additions & 1 deletion src/containerapp/azext_containerapp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long, consider-using-f-string, no-else-return, duplicate-string-formatting-argument, expression-not-assigned, too-many-locals, logging-fstring-interpolation
# pylint: disable=line-too-long, consider-using-f-string, no-else-return, duplicate-string-formatting-argument, expression-not-assigned, too-many-locals, logging-fstring-interpolation, broad-except

import time
import json
Expand Down Expand Up @@ -788,6 +788,35 @@ def _remove_readonly_attributes(containerapp_def):
del containerapp_def['properties'][unneeded_property]


def clean_null_values(d):
if isinstance(d, dict):
return {
k: v
for k, v in ((k, clean_null_values(v)) for k, v in d.items())
if v
}
if isinstance(d, list):
return [v for v in map(clean_null_values, d) if v]
return d


def _populate_secret_values(containerapp_def, secret_values):
secrets = safe_get(containerapp_def, "properties", "configuration", "secrets", default=None)
if not secrets:
secrets = []
if not secret_values:
secret_values = []
index = 0
while index < len(secrets):
value = secrets[index]
if "value" not in value or not value["value"]:
try:
value["value"] = next(s["value"] for s in secret_values if s["name"] == value["name"])
except StopIteration:
pass
index += 1


def _remove_dapr_readonly_attributes(daprcomponent_def):
unneeded_properties = [
"id",
Expand Down
Loading