From b84527d9c6af779642a5f559e32c7abef822f4ef Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Mon, 30 Sep 2024 12:22:04 +0530 Subject: [PATCH] Set auction id in deployment request --- .../deploy/webapp/publish_deployment_auction.py | 5 ++--- .../deploy/webapp/request_webapp_deployment.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/stack_orchestrator/deploy/webapp/publish_deployment_auction.py b/stack_orchestrator/deploy/webapp/publish_deployment_auction.py index edbaa8a8..36b2e710 100644 --- a/stack_orchestrator/deploy/webapp/publish_deployment_auction.py +++ b/stack_orchestrator/deploy/webapp/publish_deployment_auction.py @@ -20,12 +20,11 @@ import click import yaml from stack_orchestrator.deploy.webapp.util import ( + AUCTION_KIND_PROVIDER, + TOKEN_DENOM, LaconicRegistryClient, ) -AUCTION_KIND_PROVIDER = "provider" -TOKEN_DENOM = "alnt" - def fatal(msg: str): print(msg, file=sys.stderr) sys.exit(1) diff --git a/stack_orchestrator/deploy/webapp/request_webapp_deployment.py b/stack_orchestrator/deploy/webapp/request_webapp_deployment.py index 4345320d..885c27ac 100644 --- a/stack_orchestrator/deploy/webapp/request_webapp_deployment.py +++ b/stack_orchestrator/deploy/webapp/request_webapp_deployment.py @@ -136,9 +136,10 @@ def command( if not deployer_record: fatal(f"Unable to locate deployer: {deployer}") - deployer_records.append(deployer_records_by_owner[0]) + deployer_records.append(deployer_record) # Create and send request to each deployer + deployment_requests = [] for deployer_record in deployer_records: # If env_file if env_file: @@ -183,11 +184,15 @@ def command( "application": app, "version": "1.0.0", "name": f"{app_record.attributes.name}@{app_record.attributes.version}", - "deployer": deployer, "meta": {"when": str(datetime.utcnow())}, } } + if auction_id: + deployment_request["record"]["auction"] = auction_id + else: + deployment_request["record"]["deployer"] = deployer + if config_ref: deployment_request["record"]["config"] = {"ref": config_ref} @@ -214,11 +219,14 @@ def command( elif use_payment: deployment_request["record"]["payment"] = use_payment + deployment_requests.append(deployment_request) + + # Send all requests + for deployment_request in deployment_requests: if dry_run: print(yaml.dump(deployment_request)) - return + continue - # Send the request laconic.publish(deployment_request) finally: shutil.rmtree(tempdir, ignore_errors=True)