From 1807e973bfc9e606d38a03b2bf95c572d5af97dc Mon Sep 17 00:00:00 2001 From: Jeffrey Wilges Date: Thu, 18 Jun 2020 14:25:21 -0700 Subject: [PATCH 1/2] Always consider `domain` and `base_path` when building `endpoint_url` during an update. --- zappa/cli.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/zappa/cli.py b/zappa/cli.py index 2820eacba..d21ea2ddd 100755 --- a/zappa/cli.py +++ b/zappa/cli.py @@ -1022,11 +1022,14 @@ def update(self, source_zip=None, no_upload=False): # but we're also updating a few of the APIGW settings. endpoint_url = self.deploy_api_gateway(api_id) - if self.stage_config.get('domain', None): - endpoint_url = self.stage_config.get('domain') + if self.domain: + endpoint_url = self.domain - else: - endpoint_url = None + if endpoint_url: + if self.base_path and not endpoint_url.endswith('/' + self.base_path): + endpoint_url += '/' + self.base_path + if endpoint_url and not endpoint_url.startswith('https://'): + endpoint_url = 'https://' + endpoint_url self.schedule() @@ -1036,12 +1039,6 @@ def update(self, source_zip=None, no_upload=False): self.callback('post') - if endpoint_url and 'https://' not in endpoint_url: - endpoint_url = 'https://' + endpoint_url - - if self.base_path: - endpoint_url += '/' + self.base_path - deployed_string = "Your updated Zappa deployment is " + click.style("live", fg='green', bold=True) + "!" if self.use_apigateway: deployed_string = deployed_string + ": " + click.style("{}".format(endpoint_url), bold=True) From 1fed73376a14f1db8e9447346242085b455147d6 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilges Date: Thu, 18 Jun 2020 15:50:55 -0700 Subject: [PATCH 2/2] Always log `endpoint_url` and touch endpoint when viable during an update. --- zappa/cli.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/zappa/cli.py b/zappa/cli.py index d21ea2ddd..76ace0bd3 100755 --- a/zappa/cli.py +++ b/zappa/cli.py @@ -1040,10 +1040,12 @@ def update(self, source_zip=None, no_upload=False): self.callback('post') deployed_string = "Your updated Zappa deployment is " + click.style("live", fg='green', bold=True) + "!" - if self.use_apigateway: + + if endpoint_url: deployed_string = deployed_string + ": " + click.style("{}".format(endpoint_url), bold=True) - api_url = None + api_url = None + if self.use_apigateway: if endpoint_url and 'amazonaws.com' not in endpoint_url: api_url = self.zappa.get_api_url( self.lambda_name, @@ -1052,11 +1054,8 @@ def update(self, source_zip=None, no_upload=False): if endpoint_url != api_url: deployed_string = deployed_string + " (" + api_url + ")" - if self.stage_config.get('touch', True): - if api_url: - self.touch_endpoint(api_url) - elif endpoint_url: - self.touch_endpoint(endpoint_url) + if self.stage_config.get('touch', True) and (api_url or endpoint_url): + self.touch_endpoint(api_url or endpoint_url) click.echo(deployed_string)