The 'stopped' and 'deleted' states aren't actually defined in the spec

Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/137b91e3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/137b91e3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/137b91e3

Branch: refs/heads/ARIA-126-update-node-statuses
Commit: 137b91e359a8bdca5e23cc62724309a6f59b339c
Parents: 0ee98a6
Author: Avia Efrat <[email protected]>
Authored: Sun Mar 26 11:45:15 2017 +0300
Committer: Avia Efrat <[email protected]>
Committed: Sun Mar 26 11:45:15 2017 +0300

----------------------------------------------------------------------
 aria/modeling/service_instance.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/137b91e3/aria/modeling/service_instance.py
----------------------------------------------------------------------
diff --git a/aria/modeling/service_instance.py 
b/aria/modeling/service_instance.py
index a1c264e..810cf0e 100644
--- a/aria/modeling/service_instance.py
+++ b/aria/modeling/service_instance.py
@@ -359,26 +359,36 @@ class NodeBase(InstanceModelMixin): # pylint: 
disable=too-many-public-methods
     STARTING = 'starting'
     STARTED = 'started'
     STOPPING = 'stopping'
-    STOPPED = 'stopped'
     DELETING = 'deleting'
     DELETED = 'deleted'
+    # TODO decide what happens to a node's state after its 'deleting' state, as
+    # this is not defined as part of the tosca spec.
     ERROR = 'error'
 
     STATES = {INITIAL, CREATING, CREATED, CONFIGURING, CONFIGURED, STARTING, 
STARTED, STOPPING,
-              DELETING, ERROR}
+              DELETING, DELETED, ERROR}
 
     _op_to_state = {'create': {'transitional': CREATING, 'finished': CREATED},
                     'configure': {'transitional': CONFIGURING, 'finished': 
CONFIGURED},
                     'start': {'transitional': STARTING, 'finished': STARTED},
-                    'stop': {'transitional': STOPPING, 'finished': STOPPED},
+                    'stop': {'transitional': STOPPING, 'finished': CONFIGURED},
                     'delete': {'transitional': DELETING, 'finished': DELETED}}
 
     @classmethod
     def determine_state(cls, op_name, transitional):
+        """ :returns the state the node should be in as a result of running the
+            operation on this node.
+
+            e.g. if we are running 
tosca.interfaces.node.lifecycle.Standard.create, then
+            the resulting state should either 'creating' (if the task just 
started) or 'created'
+            (if the task ended).
+
+            If the operation is not a standard tosca lifecycle operation, then 
we return None"""
+
         state_type = 'transitional' if transitional else 'finished'
         try:
             return cls._op_to_state[op_name][state_type]
-        except AttributeError:
+        except KeyError:
             return None
 
     @declared_attr

Reply via email to