-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Block update change to labels mode #8927
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
Changes from 3 commits
043cbc0
f1555a8
f3eb4fa
393d3b5
3b0193e
cc984cf
d7bddac
45b74ba
cae0027
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ | |
|
|
||
| from msrest.exceptions import DeserializationError | ||
|
|
||
| from ._clients import ManagedEnvironmentClient, ConnectedEnvironmentClient, ManagedEnvironmentPreviewClient | ||
| from ._clients import ManagedEnvironmentClient, ConnectedEnvironmentClient, ManagedEnvironmentPreviewClient, ContainerAppPreviewClient | ||
| from ._client_factory import handle_raw_exception, handle_non_404_status_code_exception, get_linker_client | ||
| from ._models import ( | ||
| RegistryCredentials as RegistryCredentialsModel, | ||
|
|
@@ -449,6 +449,23 @@ def construct_payload(self): | |
| safe_set(self.new_containerapp, "properties", "template", "revisionSuffix", value=None) | ||
|
|
||
| if self.get_argument_revisions_mode(): | ||
| if self.get_argument_revisions_mode().lower() == "labels": | ||
Tratcher marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # Transitioning into labels mode is complicated and we don't want to combine it with other updates. | ||
| # Check if the app was previously in labels mode. If not, throw an error saying to use Set-Mode instead. | ||
| containerapp_def = None | ||
| try: | ||
| containerapp_def = ContainerAppPreviewClient.show(cmd=self.cmd, resource_group_name=self.get_argument_resource_group_name(), name=self.get_argument_name()) | ||
| except Exception as e: | ||
| handle_raw_exception(e) | ||
|
|
||
| if not containerapp_def: | ||
| raise ResourceNotFoundError("The containerapp '{}' does not exist".format(self.get_argument_name())) | ||
|
|
||
| if safe_get(containerapp_def, "properties", "configuration", "activeRevisionsMode").lower() != "labels": | ||
| raise ArgumentUsageError( | ||
| "The containerapp '{}' is not in labels mode. Please use `az containerapp revision set-mode` to switch to labels mode first.".format( | ||
|
||
| self.get_argument_name())) | ||
|
|
||
| safe_set(self.new_containerapp, "properties", "configuration", "activeRevisionsMode", value=self.get_argument_revisions_mode()) | ||
|
|
||
| if self.get_argument_target_label(): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.