소스 검색

Fix running deployments check for non-execution deployments

Daniel Vincze 1 년 전
부모
커밋
d725856f30
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      coriolis/conductor/rpc/server.py

+ 5 - 4
coriolis/conductor/rpc/server.py

@@ -1344,10 +1344,11 @@ class ConductorServerEndpoint(object):
     @staticmethod
     def _check_running_transfer_deployments(ctxt, transfer_id):
         deployments = db_api.get_transfer_deployments(ctxt, transfer_id)
-        if [m.id for m in deployments if m.executions[0].status in (
-                constants.ACTIVE_EXECUTION_STATUSES)]:
-            raise exception.InvalidTransferState(
-                "Transfer '%s' is currently being deployed" % transfer_id)
+        for d in deployments:
+            if d.executions and d.executions[0].status in (
+                    constants.ACTIVE_EXECUTION_STATUSES):
+                raise exception.InvalidTransferState(
+                    "Transfer '%s' is currently being deployed" % transfer_id)
 
     @staticmethod
     def _check_running_executions(action):