handle the case where there is no data in db yet.
[monitor.git] / monitor / wrapper / plc.py
index 76db7d8..255e3c1 100644 (file)
@@ -15,15 +15,21 @@ import traceback
 from monitor import database
 
 try:
-       import config
+       from monitor import config
        debug = config.debug
 except:
        debug = False
 logger = logging.getLogger("monitor")
        
 class Auth:
-       def __init__(self):
-               self.auth = {'AuthMethod': "anonymous"}
+       def __init__(self, username=None, password=None):
+               if username==None and password==None:
+                       self.auth = {'AuthMethod': "anonymous"}
+               else:
+                       self.auth = {'Username' : username,
+                               'AuthMethod' : 'password',
+                                               'AuthString' : password}
+                       
 
 # NOTE: this host is used by default when there are no auth files.
 XMLRPC_SERVER="https://boot.planet-lab.org/PLCAPI/"