Prechádzať zdrojové kódy

Merged in aznashwan/coriolis-core/no-executions-error (pull request #128)

Raise explicit error when trying to deploy an executionless replica.
Nashwan Azhari 7 rokov pred
rodič
commit
284f0f65c7
1 zmenil súbory, kde vykonal 3 pridanie a 0 odobranie
  1. 3 0
      coriolis/conductor/rpc/server.py

+ 3 - 0
coriolis/conductor/rpc/server.py

@@ -427,6 +427,9 @@ class ConductorServerEndpoint(object):
     def _check_valid_replica_tasks_execution(replica, force=False):
     def _check_valid_replica_tasks_execution(replica, force=False):
         sorted_executions = sorted(
         sorted_executions = sorted(
             replica.executions, key=lambda e: e.number, reverse=True)
             replica.executions, key=lambda e: e.number, reverse=True)
+        if not sorted_executions:
+            raise exception.InvalidReplicaState(
+                "The Replica has never been executed.")
 
 
         if (force and sorted_executions[0].status !=
         if (force and sorted_executions[0].status !=
                 constants.EXECUTION_STATUS_COMPLETED):
                 constants.EXECUTION_STATUS_COMPLETED):