import time
try:
from config import config
+ config = config()
debug = config.debug
except:
debug = False
logger = logging.getLogger("monitor")
-#XMLRPC_SERVER = config.XMLRPC_SERVER
-
-config = config()
api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False, allow_none=True)
def getAPI(url):
def __repr__(self):
return self.api.__repr__()
+def getAuthAPI():
+ import auth
+ return PLC(auth.auth, auth.plc)
+
'''
Returns list of nodes in dbg as reported by PLC
'''
sites = []
anon = {'AuthMethod': "anonymous"}
try:
- sites = api.GetSites(anon, filter, fields)
+ #sites = api.GetSites(anon, filter, fields)
+ sites = api.GetSites(auth.auth, filter, fields)
except Exception, exc:
+ import traceback
+ traceback.print_exc()
print "getSites: %s" % exc
logger.info("getSites: %s" % exc)
return sites
Removes ability to create slices. Returns previous max_slices
'''
def removeSliceCreation(nodename):
+ print "removeSliceCreation(%s)" % nodename
api = xmlrpclib.Server(XMLRPC_SERVER, verbose=False)
try:
loginbase = siteId(nodename)
# if len(siteid) == 1:
# logger.info("Enabling slice creation for site %s" % siteId(nodename))
# try:
-# if not config.debug:
+# if not debug:
# api.AdmUpdateSite(auth.auth, siteid[0], {"max_slices" : maxslices})
# except Exception, exc:
# logger.info("API: %s" % exc)