def getVMs(self): """ getVMs - Get all volumes of docker containers """ machines = [] volumePath = self.getVolumePath('') for host in self.hosts: volumes = subprocess.check_output(["ssh"] + DistDocker._SSH_FLAGS + DistDocker._SSH_AUTH_FLAGS + ["%s@%s" % (self.hostUser, host), "(ls %s)" % volumePath]).split('\n') for volume in volumes: if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'distDocker' machine.name = volume machine.domain_name = host volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machine.ssh_control_dir = tempfile.mkdtemp(prefix="tango-docker-ssh") machine.ssh_flags = ['-o', 'ControlPath=' + os.path.join(machine.ssh_control_dir, "control")] machine.use_ssh_master = config.Config.USE_SSH_MASTER machines.append(machine) return machines
def getVMs(self): """ getVMs - Get all volumes of docker containers """ machines = [] try: hosts=socket.gethostbyname_ex(self.hostDNSPoolname)[2] except EnvironmentError: return machines volumePath = self.getVolumePath('') for host in hosts: volumes = subprocess.check_output(["ssh"] + DistDocker._SSH_FLAGS + DistDocker._SSH_AUTH_FLAGS + ["%s@%s" % (self.hostUser, host), "(ls %s)" % volumePath]).decode('utf-8').split('\n') for volume in volumes: if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'distDocker' machine.name = volume machine.domain_name = host machine.ssh_flags = DistDocker._SSH_AUTH_FLAGS machine.use_ssh_master = False volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """ getVMs - Get all volumes of docker containers """ machines = [] try: hosts=socket.gethostbyname_ex(self.hostDNSPoolname)[2] except EnvironmentError: return machines volumePath = self.getVolumePath('') for host in hosts: volumes = subprocess.check_output(["ssh"] + DistDocker._SSH_FLAGS + DistDocker._SSH_AUTH_FLAGS + ["%s@%s" % (self.hostUser, host), "(ls %s)" % volumePath]).split('\n') for volume in volumes: if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'distDocker' machine.name = volume machine.domain_name = host machine.ssh_flags = DistDocker._SSH_AUTH_FLAGS machine.use_ssh_master = False volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """ getVMs - Executes and parses `docker ps` """ # Get all volumes of docker containers machines = [] volumePath = self.getVolumePath('') for volume in os.listdir(volumePath): if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'localDocker' machine.name = volume volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """ getVMs - Executes and parses `docker ps`. This function is a lot of parsing and can break easily. """ # Get all volumes of docker containers machines = [] volumePath = self.getVolumePath('') for volume in os.listdir(volumePath): if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = 'localDocker' machine.name = volume volume_l = volume.split('-') machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines
def getVMs(self): """getVMs - Executes and parses `docker ps`. This function is a lot of parsing and can break easily. """ # Get all volumes of docker containers machines = [] volumePath = self.getVolumePath("") for volume in os.listdir(volumePath): if re.match("%s-" % config.Config.PREFIX, volume): machine = TangoMachine() machine.vmms = "localDocker" machine.name = volume volume_l = volume.split("-") machine.id = volume_l[1] machine.image = volume_l[2] machines.append(machine) return machines