git://git.onelab.eu
/
monitor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b6200bf
)
add getNodeAPI()
author
Stephen Soltesz
<soltesz@cs.princeton.edu>
Mon, 19 Jan 2009 17:42:49 +0000
(17:42 +0000)
committer
Stephen Soltesz
<soltesz@cs.princeton.edu>
Mon, 19 Jan 2009 17:42:49 +0000
(17:42 +0000)
monitor/wrapper/plc.py
patch
|
blob
|
history
diff --git
a/monitor/wrapper/plc.py
b/monitor/wrapper/plc.py
index
c8ea068
..
68eb11a
100644
(file)
--- a/
monitor/wrapper/plc.py
+++ b/
monitor/wrapper/plc.py
@@
-22,14
+22,17
@@
except:
logger = logging.getLogger("monitor")
class Auth:
logger = logging.getLogger("monitor")
class Auth:
- def __init__(self, username=None, password=None):
- if username==None and password==None:
- self.auth = {'AuthMethod': "anonymous"}
+ def __init__(self, username=None, password=None, **kwargs):
+ if 'session' in kwargs:
+ self.auth= { 'AuthMethod' : 'session',
+ 'session' : kwargs['session'] }
else:
else:
- self.auth = {'Username' : username,
- 'AuthMethod' : 'password',
- 'AuthString' : password}
-
+ 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/"
# NOTE: this host is used by default when there are no auth files.
XMLRPC_SERVER="https://boot.planet-lab.org/PLCAPI/"
@@
-119,6
+122,10
@@
class CachedPLC(PLC):
def getAPI(url):
return xmlrpclib.Server(url, verbose=False, allow_none=True)
def getAPI(url):
return xmlrpclib.Server(url, verbose=False, allow_none=True)
+def getNodeAPI(session):
+ nodeauth = Auth(session=session)
+ return PLC(nodeauth.auth, auth.server)
+
def getAuthAPI():
return PLC(auth.auth, auth.server)
def getAuthAPI():
return PLC(auth.auth, auth.server)