git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed 'monitordebug' to failboot
[monitor.git]
/
monitor
/
wrapper
/
plc.py
diff --git
a/monitor/wrapper/plc.py
b/monitor/wrapper/plc.py
index
8f70c1f
..
62de999
100644
(file)
--- a/
monitor/wrapper/plc.py
+++ b/
monitor/wrapper/plc.py
@@
-71,7
+71,7
@@
class PLC:
try:
return lambda *params : method(self.auth, *params)
try:
return lambda *params : method(self.auth, *params)
- except ProtocolError:
+ except
xmlrpclib.
ProtocolError:
traceback.print_exc()
global_error_count += 1
if global_error_count >= 10:
traceback.print_exc()
global_error_count += 1
if global_error_count >= 10:
@@
-84,7
+84,6
@@
class PLC:
def __repr__(self):
return self.api.__repr__()
def __repr__(self):
return self.api.__repr__()
-api = PLC(auth.auth, auth.server)
class CachedPLC(PLC):
class CachedPLC(PLC):
@@
-132,6
+131,9
@@
class CachedPLC(PLC):
return run_or_returncached
return run_or_returncached
+api = PLC(auth.auth, auth.server)
+cacheapi = CachedPLC(auth.auth, auth.server)
+
def getAPI(url):
return xmlrpclib.Server(url, verbose=False, allow_none=True)
def getAPI(url):
return xmlrpclib.Server(url, verbose=False, allow_none=True)
@@
-140,12
+142,22
@@
def getNodeAPI(session):
nodeauth = Auth(session=session)
return PLC(nodeauth.auth, auth.server)
nodeauth = Auth(session=session)
return PLC(nodeauth.auth, auth.server)
-def getAuthAPI():
- return PLC(auth.auth, auth.server)
+def getAuthAPI(url=None):
+ if url:
+ return PLC(auth.auth, url)
+ else:
+ return PLC(auth.auth, auth.server)
def getCachedAuthAPI():
return CachedPLC(auth.auth, auth.server)
def getCachedAuthAPI():
return CachedPLC(auth.auth, auth.server)
+def getSessionAPI(session, server):
+ nodeauth = Auth(session=session)
+ return PLC(nodeauth.auth, server)
+def getUserAPI(username, password, server):
+ auth = Auth(username,password)
+ return PLC(auth.auth, server)
+
def getTechEmails(loginbase):
"""
For the given site, return all user email addresses that have the 'tech' role.
def getTechEmails(loginbase):
"""
For the given site, return all user email addresses that have the 'tech' role.