Skip to content

Commit

Permalink
Merge pull request Azure#112 from lil131/location-fix
Browse files Browse the repository at this point in the history
fix hostname location parameter & add hostname tests with ASD
  • Loading branch information
StrawnSC authored May 22, 2022
2 parents 4739052 + cf297ae commit a6fb46d
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 2,046 deletions.
1 change: 1 addition & 0 deletions src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def load_arguments(self, _):

with self.argument_context('containerapp hostname list') as c:
c.argument('name', id_part=None)
c.argument('location', configured_default='location')

with self.argument_context('containerapp hostname delete') as c:
c.argument('hostname', help='The custom domain name.')
8 changes: 5 additions & 3 deletions src/containerapp/azext_containerapp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ def load_cert_file(file_path, cert_password=None):
else:
raise FileOperationError('Not a valid file type. Only .PFX and .PEM files are supported.')
except Exception as e:
raise CLIInternalError(e)
raise CLIInternalError(e) from e
return blob, thumbprint


Expand Down Expand Up @@ -1193,8 +1193,10 @@ def patch_new_custom_domain(cmd, resource_group_name, name, new_custom_domains):
def get_custom_domains(cmd, resource_group_name, name, location=None, environment=None):
try:
app = ContainerAppClient.show(cmd=cmd, resource_group_name=resource_group_name, name=name)
if location and (app["location"] != location):
raise ResourceNotFoundError('Container app {} is not in location {}.'.format(name, location))
if location:
_ensure_location_allowed(cmd, location, "Microsoft.App", "containerApps")
if _normalize_location(cmd, app["location"]) != _normalize_location(cmd, location):
raise ResourceNotFoundError('Container app {} is not in location {}.'.format(name, location))
if environment and (_get_name(environment) != _get_name(app["properties"]["managedEnvironmentId"])):
raise ResourceNotFoundError('Container app {} is not under environment {}.'.format(name, environment))
if "ingress" in app["properties"]["configuration"] and "customDomains" in app["properties"]["configuration"]["ingress"]:
Expand Down
4 changes: 2 additions & 2 deletions src/containerapp/azext_containerapp/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
_ensure_identity_resource_id, _remove_dapr_readonly_attributes, _remove_env_vars, _validate_traffic_sum,
_update_revision_env_secretrefs, _get_acr_cred, safe_get, await_github_action, repo_url_to_name,
validate_container_app_name, _update_weights, get_vnet_location, register_provider_if_needed,
generate_randomized_cert_name, _get_name, _update_weights, get_vnet_location, load_cert_file,
check_cert_name_availability, validate_hostname, patch_new_custom_domain, get_custom_domains)
generate_randomized_cert_name, _get_name, load_cert_file, check_cert_name_availability,
validate_hostname, patch_new_custom_domain, get_custom_domains)

from ._ssh_utils import (SSH_DEFAULT_ENCODING, WebSocketConnection, read_ssh, get_stdin_writer, SSH_CTRL_C_MSG,
SSH_BACKUP_ENCODING)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"address1": {
"value": "One Microsoft Way"
},
"address2": {
"value": ""
},
"city": {
"value": "Seattle"
},
"country": {
"value": "US"
},
"postal_code": {
"value": "98109"
},
"state": {
"value": "WA"
},
"email": {
"value": "testemail@hotmail.com"
},
"fax": {
"value": ""
},
"job_title": {
"value": ""
},
"name_first": {
"value": "Jane"
},
"name_last": {
"value": "Doe"
},
"name_middle": {
"value": ""
},
"organization": {
"value": ""
},
"phone": {
"value": "+1.2061234567"
}
}
Loading

0 comments on commit a6fb46d

Please sign in to comment.