Example #1
0
def enviarLevantarVM(proyecto,VM,slave):
    comando="curl http://" + slave + ":" + config.SLAVE1PORT + "/LevantarVM/" + proyecto + "/" + VM
    logger.warning('Ingresando a enviarLevantarVM')
    try:
        logger.warning('Ejecutando..' + comando)
        output=RunCLI.runCommand(comando)
        opJson.escribirJson(config.MSGSlave,proyecto,output)       
    except Exception as e:
        logger.error(sys.exc_info()[1])        
Example #2
0
def enviarBorrarProyecto(proyecto, slave, port):
    comando = "curl http://" + slave + ":" + str(
        port) + "/BorrarProyecto/" + proyecto
    logger.warning('Ingresando a enviarBorrarProyecto')
    try:
        logger.warning('Ejecutando..' + comando)
        output = RunCLI.runCommand(comando)
        opJson.escribirJson(config.MSGSlave, proyecto, output)
    except Exception as e:
        logger.error(sys.exc_info()[1])
Example #3
0
def enviarVM(proyecto,slave):
    comando="curl -F file=@" + config.VAGRANTSERVICEHOME + proyecto + "/Vagrantfile" + " http://" + slave + ":" + config.SLAVE1PORT +"/CrearProyecto/" + proyecto
    logger.warning('Ingresando a enviarVM')
    try:
        logger.warning('Ejecutando..' + comando)
        output=RunCLI.runCommand(comando)
        opJson.escribirJson(config.MSGSlave,proyecto,output) 

    except Exception as e:
        logger.error(sys.exc_info()[1])
Example #4
0
def preguntarEstadoProyecto(proyecto,slave):
    comando="curl http://" + slave + ":" + config.SLAVE1PORT + "/StatusProyecto/" + proyecto
    logger.warning('Ingresando a preguntarEstadoProyecto')
    try:
        logger.warning('Ejecutando..' + comando)
        output=RunCLI.runCommand(comando)
        opJson.escribirJson(config.MSGSlave,proyecto,output) 
        #del mensaje del slave se saca la info del estado de cada virtual
        data=opJson.abrirArchivo(config.MSGSlave)
        if proyecto in data:
            for VM,atributo in data[proyecto][0]["VMs"].items():
                manageBD.modificarVM(proyecto,VM,"",atributo["Status"])
    except Exception as e:
        logger.error(sys.exc_info()[1])
Example #5
0
def consultarSlaveRAM():
    if os.path.isfile(config.BDSlave) == True:
        try:
            slave = opJson.abrirArchivo(config.BDSlave)
            for key, atributos in slave.items():
                comando = 'curl http://' + key + ':' + str(
                    atributos['Port']) + '/ObtenerRAM'
                logger.warning('Ejecutando..' + comando)
                output = RunCLI.runCommand(comando)
                opJson.escribirJson(config.MSGSlaveStatus, key, output)
                data = opJson.abrirArchivo(config.MSGSlaveStatus)
                manageBD.modificarSlaveRAM(key, data[str(key)]['MemFree'])
                return True
        except Exception as e:
            logger.error(sys.exc_info()[1])