Exemplo n.º 1
0
def get_status_remote(url, web_session_remote=None):
	"""This handles authorization"""
	newuser = None
	try:
		url = "%s/xml" %(url)
		if web_session_remote == None:
			web_session_remote = websessionremote.web_session_remote()
		data = web_session_remote.get(url)
		dom = xml.dom.minidom.parseString(data.read())
		return dom
	except Exception, e:
		logger.error("%s", e)
		raise e
Exemplo n.º 2
0
def get_status_remote(url, web_session_remote=None):
    """This handles authorization"""
    newuser = None
    try:
        url = "%s/xml" % (url)
        if web_session_remote == None:
            web_session_remote = websessionremote.web_session_remote()
        data = web_session_remote.get(url)
        dom = xml.dom.minidom.parseString(data.read())
        return dom
    except Exception, e:
        logger.error("%s", e)
        raise e
Exemplo n.º 3
0
def nagios_rm_trans_remote(transaction, web_session_remote=None):
    """This lets you remotely delete a nagios transaction"""
    try:
        # FIXME which host to remove from
        url = "https://a3.my.emsl.pnl.gov/myemsl/nagiosrmtrans/%s" % (transaction)
        if web_session_remote == None:
            web_session_remote = websessionremote.web_session_remote()
        data = web_session_remote.get(url)
        d = data.read()
        if d == "OK\n":
            return True
        raise Exception(d)
    except Exception, e:
        logger.error("%s", e)
        raise e
Exemplo n.º 4
0
def get_file_remote(server, filename, protocol="http", web_session_remote=None):
	"""Get remote myemsl file"""
	newuser = None
	try:
		filename = urllib.quote_plus(filename, safe='/')
		array = filename.rsplit('/', 1)
		if len(array) > 1:
			dir = array[0]
			file = array[1]
		else:
			dir = '/'
			file = filename
		url = "%s://%s/myemsl/files-basic/index.php?dir=%s&file=%s" %(protocol, server, dir, file)
		if web_session_remote == None:
			web_session_remote = websessionremote.web_session_remote()
		data = web_session_remote.get(url)
		return data.read()
	except Exception, e:
		logger.error("%s", e)
		raise