Code cleanup. Setting resource state through specific functions
[nepi.git] / src / nepi / resources / linux / ccn / ccnr.py
index ac10840..378f93c 100644 (file)
@@ -225,8 +225,7 @@ class LinuxCCNR(LinuxApplication):
                 raise
  
             self.debug("----- READY ---- ")
-            self._ready_time = tnow()
-            self._state = ResourceState.READY
+            self.set_ready()
 
     def upload_start_command(self):
         command = self.get("command")
@@ -257,16 +256,15 @@ class LinuxCCNR(LinuxApplication):
                 raise_on_error = True)
 
     def start(self):
-        if self._state == ResourceState.READY:
+        if self.state == ResourceState.READY:
             command = self.get("command")
             self.info("Starting command '%s'" % command)
 
-            self._start_time = tnow()
-            self._state = ResourceState.STARTED
+            self.set_started()
         else:
             msg = " Failed to execute command '%s'" % command
             self.error(msg, out, err)
-            self._state = ResourceState.FAILED
+            self.fail()
             raise RuntimeError, msg
 
     @property