Adding help and background class atrributes to ResourceManager
[nepi.git] / src / nepi / resources / linux / interface.py
index 6fab54a..26a1549 100644 (file)
@@ -18,7 +18,8 @@
 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
 
 from nepi.execution.attribute import Attribute, Types, Flags
-from nepi.execution.resource import ResourceManager, clsinit, ResourceState
+from nepi.execution.resource import ResourceManager, clsinit, ResourceState, \
+        reschedule_delay
 from nepi.resources.linux.node import LinuxNode
 from nepi.resources.linux.channel import LinuxChannel
 
@@ -31,11 +32,12 @@ import time
 
 # TODO: UP, MTU attributes!
 
-reschedule_delay = "0.5s"
 
 @clsinit
 class LinuxInterface(ResourceManager):
     _rtype = "LinuxInterface"
+    _help = "Controls network devices on Linux hosts through the ifconfig tool"
+    _backend = "linux"
 
     @classmethod
     def _register_attributes(cls):
@@ -110,7 +112,7 @@ class LinuxInterface(ResourceManager):
         mtu = self.get("mtu")
 
         # Get current interfaces information
-        (out, err), proc = self.node.execute("ifconfig", sudo = True)
+        (out, err), proc = self.node.execute("ifconfig", sudo = True, tty = True)
 
         if err and proc.poll():
             msg = " Error retrieving interface information "
@@ -240,7 +242,7 @@ class LinuxInterface(ResourceManager):
                 self.discover()
                 self.provision()
             except:
-                self._state = ResourceState.FAILED
+                self.fail()
                 raise
 
             super(LinuxInterface, self).deploy()