From 27a6470ad916762cca7ad65859ea6e9c1f0ae4fc Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 30 Jan 2025 11:33:33 +0530 Subject: [PATCH] Require IP input with allow FQDN policy --- .../deploy/webapp/deploy_webapp_from_registry.py | 7 +++++++ stack_orchestrator/deploy/webapp/util.py | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py index a4606dc9..228cd7a8 100644 --- a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py +++ b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py @@ -433,6 +433,13 @@ def command( # noqa: C901 ) sys.exit(2) + if fqdn_policy == "allow" and not ip: + print( + "--ip is required with 'allow' fqdn-policy", + file=sys.stderr, + ) + sys.exit(2) + tempdir = tempfile.mkdtemp() gpg = gnupg.GPG(gnupghome=tempdir) diff --git a/stack_orchestrator/deploy/webapp/util.py b/stack_orchestrator/deploy/webapp/util.py index 375ee5be..1b52cab0 100644 --- a/stack_orchestrator/deploy/webapp/util.py +++ b/stack_orchestrator/deploy/webapp/util.py @@ -688,7 +688,7 @@ def publish_deployment( deployment_lrn, dns_record, dns_lrn, - dns_value: str, + dns_value: str | None, deployment_dir, app_deployment_request=None, webapp_deployer_record=None, @@ -717,12 +717,13 @@ def publish_deployment( "version": dns_ver, "name": fqdn, "resource_type": "A", - "value": dns_value, "meta": {"so": uniq.hex}, } } if app_deployment_request: new_dns_record["record"]["request"] = app_deployment_request.id + if dns_value: + new_dns_record["record"]["value"] = dns_value if logger: logger.log("Publishing DnsRecord.")