fixed and moved the server-side yum scripts, from nodeconfig/yum to BootstrapFS/nodec...
[nodemanager.git] / tools.py
index f3e67e1..7505bd1 100644 (file)
--- a/tools.py
+++ b/tools.py
@@ -1,3 +1,6 @@
+# $Id$
+# $URL$
+
 """A few things that didn't seem to fit anywhere else."""
 
 import cPickle
@@ -9,10 +12,6 @@ import threading
 import fcntl
 import commands
 import logger
-try:
-   import sioc
-except:
-   pass
 
 PID_FILE = '/var/run/nm.pid'
 
@@ -22,12 +21,16 @@ def get_default_if():
     return interface
 
 def get_hwaddr_from_plnode():
-    for line in open("/usr/boot/plnode.txt", 'r').readlines():
-        if line.startswith("NET_DEVICE"):
-            return line.split("=")[1].strip().strip('"')
+    try:
+        for line in open("/usr/boot/plnode.txt", 'r').readlines():
+            if line.startswith("NET_DEVICE"):
+                return line.split("=")[1].strip().strip('"')
+    except:
+        pass
     return None
 
 def get_if_from_hwaddr(hwaddr):
+    import sioc
     devs = sioc.gifconf()
     for dev in devs:
         dev_hwaddr = sioc.gifhwaddr(dev)
@@ -125,18 +128,6 @@ def node_id():
             _node_id=""
     return _node_id
 
-# get slicefamily from /etc/planetlab/slicefamily and cache it
-# http://svn.planet-lab.org/wiki/SliceFamily
-_slicefamily=None
-def slicefamily():
-    global _slicefamily
-    if _slicefamily is None:
-        try:
-            _slicefamily=file("/etc/planetlab/slicefamily").read().strip()
-        except:
-            _slicefamily=""
-    return _slicefamily
-
 _root_context_arch=None
 def root_context_arch():
     global _root_context_arch