Fixing nasty ugly bug in DCE ccndc RM. Fix: Adding missing HOME environment set to...
[nepi.git] / src / nepi / resources / linux / ns3 / ccn / ns3fibentrydceapplication.py
index 63e5d19..6137825 100644 (file)
@@ -53,11 +53,16 @@ class LinuxNS3DceFIBEntry(LinuxNS3CCNDceApplication):
                 "Peer host public IP used in network connection for this FIB entry. ",
                 flags = Flags.Design)
 
+        home = Attribute("home", "Sets HOME environmental variable. ",
+                default = "/root",
+            flags = Flags.Design)
         cls._register_attribute(uri)
         cls._register_attribute(protocol)
         cls._register_attribute(host)
         cls._register_attribute(port)
         cls._register_attribute(ip)
+        cls._register_attribute(home)
 
     def _instantiate_object(self):
         if not self.get("binary"):
@@ -66,8 +71,22 @@ class LinuxNS3DceFIBEntry(LinuxNS3CCNDceApplication):
         if not self.get("arguments"):
             self.set("arguments", self._arguments)
 
+        if not self.get("environment"):
+            self.set("environment", self._environment)
+        
         super(LinuxNS3DceFIBEntry, self)._instantiate_object()
 
+    @property
+    def _environment(self):
+        envs = dict({
+            "home": "HOME",
+            })
+
+        env = ";".join(map(lambda k: "%s=%s" % (envs.get(k), str(self.get(k))), 
+            [k for k in envs.keys() if self.get(k)]))
+
+        return env
+
     @property
     def _arguments(self):
         args = ["-v", "add"]