Explorar o código

Fix deployment creation for cron triggered deployments

Fixes an issue where a transfer execution schedule with
`auto_deploy` enabled will create a deployment with user and
project ID missing from the request context. This patch applies
the transfer user and project IDs to the deployment, in case they
are missing from the request context.
Daniel Vincze hai 1 ano
pai
achega
c430714cfc
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      coriolis/db/api.py

+ 3 - 2
coriolis/db/api.py

@@ -599,8 +599,9 @@ def get_deployment(context, deployment_id, include_task_info=False,
 
 @enginefacade.writer
 def add_deployment(context, deployment):
-    deployment.user_id = context.user
-    deployment.project_id = context.project_id
+    deployment.user_id = context.user or deployment.transfer.user_id
+    deployment.project_id = (
+        context.project_id or deployment.transfer.project_id)
     _session(context).add(deployment)