From ef33219b7233d5c64afdd75dff585b39b7bd9f69 Mon Sep 17 00:00:00 2001 From: linluliu Date: Fri, 7 Apr 2023 18:21:59 -0700 Subject: [PATCH 1/4] fix validation method prompt --- src/containerapp/azext_containerapp/custom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index 75295cc9114..3056de7deda 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -3143,9 +3143,9 @@ def bind_hostname(cmd, resource_group_name, name, hostname, thumbprint=None, cer while validation not in ["TXT", "CNAME", "HTTP"]: validation = prompt_str('\nPlease choose one of the following domain validation methods: TXT, CNAME, HTTP\nYour answer: ') - certificate_envelop = prepare_managed_certificate_envelop(cmd, env_name, resource_group_name, standardized_hostname, validation_method, location) + certificate_envelop = prepare_managed_certificate_envelop(cmd, env_name, resource_group_name, standardized_hostname, validation, location) try: - managed_cert = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, env_name, cert_name, certificate_envelop, False, validation_method == 'TXT') + managed_cert = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, env_name, cert_name, certificate_envelop, False, validation == 'TXT') except Exception as e: handle_raw_exception(e) cert_id = managed_cert["id"] From 69b8e435f56793f3f31b96d153c695b739ab54bd Mon Sep 17 00:00:00 2001 From: linluliu Date: Mon, 10 Apr 2023 14:48:23 -0700 Subject: [PATCH 2/4] increase version number --- src/containerapp/HISTORY.rst | 3 ++- src/containerapp/setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index 20408540812..97b8d6c95e0 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -2,8 +2,9 @@ Release History =============== -Upcoming +0.3.28 +++++++ +* 'az containerapp hostname bind': fix bug where the prompt for validation method didn't take value in * 'az containerapp up': fix --location comparison logic * 'az containerapp update': change --max-replicas limit * Add CLI support for containerapp ingress sticky-sessions' diff --git a/src/containerapp/setup.py b/src/containerapp/setup.py index f672bc090b6..4b4409cc514 100644 --- a/src/containerapp/setup.py +++ b/src/containerapp/setup.py @@ -17,7 +17,7 @@ # TODO: Confirm this is the right version number you want and it matches your # HISTORY.rst entry. -VERSION = '0.3.27' +VERSION = '0.3.28' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers From 566d4edbbffbfaff81dd87d7fc044c9fb1d2b5d5 Mon Sep 17 00:00:00 2001 From: linluliu Date: Mon, 10 Apr 2023 17:22:33 -0700 Subject: [PATCH 3/4] make validation-method case insensitive --- src/containerapp/HISTORY.rst | 1 + src/containerapp/azext_containerapp/custom.py | 8 ++++---- .../tests/latest/test_containerapp_env_commands.py | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index 97b8d6c95e0..f5bfa560dcf 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -5,6 +5,7 @@ Release History 0.3.28 +++++++ * 'az containerapp hostname bind': fix bug where the prompt for validation method didn't take value in +* Make --validation-method parameter case insensitive for 'az containerapp hostname bind' and 'az containerapp env certificate create' * 'az containerapp up': fix --location comparison logic * 'az containerapp update': change --max-replicas limit * Add CLI support for containerapp ingress sticky-sessions' diff --git a/src/containerapp/azext_containerapp/custom.py b/src/containerapp/azext_containerapp/custom.py index 3056de7deda..ba158dbbca1 100644 --- a/src/containerapp/azext_containerapp/custom.py +++ b/src/containerapp/azext_containerapp/custom.py @@ -2912,9 +2912,9 @@ def create_managed_certificate(cmd, name, resource_group_name, hostname, validat cert_name = generate_randomized_managed_cert_name(hostname, resource_group_name) if not check_managed_cert_name_availability(cmd, resource_group_name, name, certificate_name): cert_name = None - certificate_envelop = prepare_managed_certificate_envelop(cmd, name, resource_group_name, hostname, validation_method) + certificate_envelop = prepare_managed_certificate_envelop(cmd, name, resource_group_name, hostname, validation_method.upper()) try: - r = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, name, cert_name, certificate_envelop, True, validation_method == 'TXT') + r = ManagedEnvironmentClient.create_or_update_managed_certificate(cmd, resource_group_name, name, cert_name, certificate_envelop, True, validation_method.upper() == 'TXT') return r except Exception as e: handle_raw_exception(e) @@ -3139,9 +3139,9 @@ def bind_hostname(cmd, resource_group_name, name, hostname, thumbprint=None, cer cert_name = random_name logger.warning("Creating managed certificate '%s' for %s.\nIt may take up to 20 minutes to create and issue a managed certificate.", cert_name, standardized_hostname) - validation = validation_method + validation = validation_method.upper() while validation not in ["TXT", "CNAME", "HTTP"]: - validation = prompt_str('\nPlease choose one of the following domain validation methods: TXT, CNAME, HTTP\nYour answer: ') + validation = prompt_str('\nPlease choose one of the following domain validation methods: TXT, CNAME, HTTP\nYour answer: ').upper() certificate_envelop = prepare_managed_certificate_envelop(cmd, env_name, resource_group_name, standardized_hostname, validation, location) try: diff --git a/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py b/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py index c81f027e6b6..1eeb5b07b6d 100644 --- a/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py +++ b/src/containerapp/azext_containerapp/tests/latest/test_containerapp_env_commands.py @@ -288,13 +288,13 @@ def test_containerapp_env_certificate_e2e(self, resource_group): self.cmd('containerapp hostname add -g {} -n {} --hostname {}'.format(resource_group, ca_name, hostname_1), expect_failure=True) # create a managed certificate - self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v CNAME -c {}'.format(env_name, resource_group, hostname_1, cert_name), checks=[ + self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v cname -c {}'.format(env_name, resource_group, hostname_1, cert_name), checks=[ JMESPathCheck('type', "Microsoft.App/managedEnvironments/managedCertificates"), JMESPathCheck('name', cert_name), JMESPathCheck('properties.subjectName', hostname_1), ]).get_output_in_json() - self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v CNAME'.format(env_name, resource_group, hostname_1), expect_failure=True) + self.cmd('containerapp env certificate create -n {} -g {} --hostname {} -v cname'.format(env_name, resource_group, hostname_1), expect_failure=True) self.cmd('containerapp env certificate list -g {} -n {} -m'.format(resource_group, env_name), checks=[ JMESPathCheck('length(@)', 1), ]) @@ -309,7 +309,7 @@ def test_containerapp_env_certificate_e2e(self, resource_group): JMESPathCheck('length(@)', 0), ]) - self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --environment {} -v CNAME'.format(resource_group, ca_name, hostname_1, env_name)) + self.cmd('containerapp hostname bind -g {} -n {} --hostname {} --environment {} -v cname'.format(resource_group, ca_name, hostname_1, env_name)) certs = self.cmd('containerapp env certificate list -g {} -n {}'.format(resource_group, env_name), checks=[ JMESPathCheck('length(@)', 1), ]).get_output_in_json() From 955c4085373a459751c28fa31d33213d6dae1fdd Mon Sep 17 00:00:00 2001 From: Linlu Liu Date: Thu, 20 Apr 2023 18:32:15 -0700 Subject: [PATCH 4/4] mark changes as upcoming --- src/containerapp/HISTORY.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/containerapp/HISTORY.rst b/src/containerapp/HISTORY.rst index 3055cc59b3f..bc7793479e5 100644 --- a/src/containerapp/HISTORY.rst +++ b/src/containerapp/HISTORY.rst @@ -2,10 +2,13 @@ Release History =============== -0.3.28 -+++++++ +Upcoming +++++++ * 'az containerapp hostname bind': fix bug where the prompt for validation method didn't take value in * Make --validation-method parameter case insensitive for 'az containerapp hostname bind' and 'az containerapp env certificate create' + +0.3.28 +++++++ * 'az containerapp secret set': fix help typo * 'az containerapp secret set': add more format validation for key vault secrets * 'az containerapp up': fix --location comparison logic