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

Bugfixes (Help, remove app-subnet-resource-id, removed env-var alias, added help text for --name) #28

Merged
merged 27 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cbd026a
Moved dapr arguments to env as a subgroup.
Mar 15, 2022
e37a07c
Added env variable options.
Mar 15, 2022
b582910
Changed revision mode set to revision set-mode.
Mar 15, 2022
7b33faa
Added env var options to revision copy.
Mar 15, 2022
35e6ca2
Fixed revision copy bug related to env secret refs.
Mar 15, 2022
43e98f5
Changed registry and secret delete to remove. Added registry param he…
Mar 15, 2022
4c47767
Merge branch 'containerapp' into bugfixes
runefa Mar 15, 2022
7c90ee0
Updating warning text.
Mar 16, 2022
8024682
Updated warning text once more.
Mar 16, 2022
3544c8c
Made name optional for revision copy if from-revision flag is passed.
Mar 16, 2022
0f7d7f2
Fixed whitespace style issues.
Mar 16, 2022
858f828
Styled clients and utils to pass pylint.
Mar 17, 2022
570b6cb
Finished client.py pylint fixes.
Mar 17, 2022
01f1bc3
Fixed pylint issues.
Mar 17, 2022
2893b55
Fixed flake8 commands and custom.
Mar 17, 2022
a63dbc6
Fixed flake issues in src.
Mar 17, 2022
5294ff9
Added license header to _sdk_models.
Mar 17, 2022
82f389c
Added confirmation for containerapp delete.
Mar 17, 2022
75327ff
Merged containerapp.
Mar 18, 2022
04b4705
Update helps for identity, revision. Removed env-var alias for set-en…
Mar 18, 2022
1003727
Removed app-subnet-resource-id.
Mar 18, 2022
ea6f741
Merge containerapp.
Mar 18, 2022
ab81c23
Updated infrastructure subnet param help.
Mar 18, 2022
8aa4e0a
Check if containerapp resource exists before attempting to delete.
Mar 18, 2022
e3b5ef6
Added check before deleting managed env.
Mar 18, 2022
d83e276
Changed error types to be more specific.
Mar 21, 2022
f9e3d96
Removed check before deletion. Removed comments.
Mar 21, 2022
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
11 changes: 5 additions & 6 deletions src/containerapp/azext_containerapp/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType

from knack.util import CLIError
from azure.cli.core.azclierror import CLIInternalError


# pylint: disable=inconsistent-return-statements
Expand All @@ -21,7 +20,7 @@ def _polish_bad_errors(ex):
elif 'Message' in content:
detail = content['Message']

ex = CLIError(detail)
ex = CLIInternalError(detail)
except Exception: # pylint: disable=broad-except
pass
if no_throw:
Expand All @@ -45,13 +44,13 @@ def handle_raw_exception(e):
if 'code' in jsonError and 'message' in jsonError:
code = jsonError['code']
message = jsonError['message']
raise CLIError('({}) {}'.format(code, message))
raise CLIInternalError('({}) {}'.format(code, message))
elif "Message" in jsonError:
message = jsonError["Message"]
raise CLIError(message)
raise CLIInternalError(message)
elif "message" in jsonError:
message = jsonError["message"]
raise CLIError(message)
raise CLIInternalError(message)
raise e


Expand Down
18 changes: 13 additions & 5 deletions src/containerapp/azext_containerapp/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
examples:
- name: Restart a revision.
text: |
az containerapp revision restart -n MyContainerapp -g MyResourceGroup --revision-name MyContainerappRevision
az containerapp revision restart -n MyContainerapp -g MyResourceGroup --revision MyContainerappRevision
"""

helps['containerapp revision activate'] = """
Expand All @@ -133,7 +133,7 @@
examples:
- name: Activate a revision.
text: |
az containerapp revision activate -n MyContainerapp -g MyResourceGroup --revision-name MyContainerappRevision
az containerapp revision activate -g MyResourceGroup --revision MyContainerappRevision
"""

helps['containerapp revision deactivate'] = """
Expand All @@ -142,7 +142,7 @@
examples:
- name: Deactivate a revision.
text: |
az containerapp revision deactivate -n MyContainerapp -g MyResourceGroup --revision-name MyContainerappRevision
az containerapp revision deactivate -g MyResourceGroup --revision MyContainerappRevision
"""

helps['containerapp revision set-mode'] = """
Expand All @@ -158,10 +158,15 @@
type: command
short-summary: Create a revision based on a previous revision.
examples:
- name: Create a revision based on a previous revision.
- name: Create a revision based on the latest revision.
text: |
az containerapp revision copy -n MyContainerapp -g MyResourceGroup \\
--cpu 0.75 --memory 1.5Gi
- name: Create a revision based on a previous revision.
text: |
az containerapp revision copy -g MyResourceGroup \\
--from-revision PreviousRevisionName --cpu 0.75 --memory 1.5Gi

"""

helps['containerapp revision copy'] = """
Expand Down Expand Up @@ -231,7 +236,7 @@

helps['containerapp env dapr-component'] = """
type: group
short-summary: Commands to manage Container App environment dapr components.
short-summary: Commmands to manage dapr components on the Container App environment.
"""

helps['containerapp env dapr-component list'] = """
Expand Down Expand Up @@ -284,6 +289,9 @@
- name: Assign system identity.
text: |
az containerapp identity assign
- name: Assign user identity.
text: |
az containerapp identity assign --identities myAssignedId
- name: Assign system and user identity.
text: |
az containerapp identity assign --identities [system] myAssignedId
Expand Down
6 changes: 3 additions & 3 deletions src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def load_arguments(self, _):

with self.argument_context('containerapp') as c:
# Base arguments
c.argument('name', name_type, metavar='NAME', id_part='name')
c.argument('name', name_type, metavar='NAME', id_part='name', help="The name of the Containerapp.")
c.argument('resource_group_name', arg_type=resource_group_name_type)
c.argument('location', arg_type=get_location_type(self.cli_ctx))

Expand All @@ -43,7 +43,7 @@ def load_arguments(self, _):

# Env vars
with self.argument_context('containerapp', arg_group='Environment variables (Creates new revision)') as c:
c.argument('set_env_vars', options_list=['--set-env-vars, --env-vars'], nargs='*', help="A list of environment variable(s) to add to the container. Space-separated values in 'key=value' format. If stored as a secret, value must start with \'secretref:\' followed by the secret name.")
c.argument('set_env_vars', nargs='*', help="A list of environment variable(s) to add to the container. Space-separated values in 'key=value' format. If stored as a secret, value must start with \'secretref:\' followed by the secret name.")
c.argument('remove_env_vars', nargs='*', help="A list of environment variable(s) to remove from container. Space-separated env var name values.")
c.argument('replace_env_vars', nargs='*', help="A list of environment variable(s) to replace from the container. Space-separated values in 'key=value' format. If stored as a secret, value must start with \'secretref:\' followed by the secret name.")
c.argument('remove_all_env_vars', help="Option to remove all environment variable(s) from the container.")
Expand Down Expand Up @@ -97,7 +97,7 @@ def load_arguments(self, _):
c.argument('instrumentation_key', options_list=['--dapr-instrumentation-key'], help='Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry')

with self.argument_context('containerapp env', arg_group='Virtual Network') as c:
c.argument('infrastructure_subnet_resource_id', type=str, options_list=['--infrastructure-subnet-resource-id'], help='Resource ID of a subnet for infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId.')
runefa marked this conversation as resolved.
Show resolved Hide resolved
c.argument('infrastructure_subnet_resource_id', type=str, options_list=['--infrastructure-subnet-resource-id'], help='Resource ID of a subnet for infrastructure components and user app containers.')
c.argument('app_subnet_resource_id', type=str, options_list=['--app-subnet-resource-id'], help='Resource ID of a subnet that Container App containers are injected into. This subnet must be in the same VNET as the subnet defined in infrastructureSubnetResourceId.')
c.argument('docker_bridge_cidr', type=str, options_list=['--docker-bridge-cidr'], help='CIDR notation IP range assigned to the Docker bridge. It must not overlap with any Subnet IP ranges or the IP range defined in Platform Reserved CIDR, if defined')
c.argument('platform_reserved_cidr', type=str, options_list=['--platform-reserved-cidr'], help='IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. It must not overlap with any other Subnet IP ranges')
Expand Down
Loading