Przeglądaj źródła

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 1 rok temu
rodzic
commit
c430714cfc
1 zmienionych plików z 3 dodań i 2 usunięć
  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)