X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=monitor%2Fwrapper%2Fplc.py;h=255e3c1990d97f6c4bbbab8a4dae839e232d5586;hb=9a3f616ba7f24ef6dd9b0de395ba7d997c273a13;hp=76db7d8699dd6052d43930d2b8f621d2550fa8fb;hpb=0fabfc8dbe8f1f2c0d12397e1bc8c6ed686fb5ed;p=monitor.git diff --git a/monitor/wrapper/plc.py b/monitor/wrapper/plc.py index 76db7d8..255e3c1 100644 --- a/monitor/wrapper/plc.py +++ b/monitor/wrapper/plc.py @@ -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/"