Asks docker-machine for active machine and gets the UID of the docker user
    inside the vm
    :return: tuple (UID, GID), or (None, None) if error (e.g. docker-machine not present or stopped)
165913
def docker_machine_id():  # type: () -> Tuple[Optional[int], Optional[int]]
    
    machine_name = docker_machine_name()
    if not machine_name:
        return (None, None)
    uid = cmd_output_to_int(['docker-machine', 'ssh', machine_name, "id -u"])
    gid = cmd_output_to_int(['docker-machine', 'ssh', machine_name, "id -g"])
    return (uid, gid)
662970
def get_container_ip(container_id_or_name):
    """"""
    command = [
        'docker',
        'inspect',
        '-f',
        '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}',
        container_id_or_name,
    ]

    return run_command(command, capture='out', check=True).stdout.strip()
666441
def get_uid(user=None):
    '''
    
    '''
    if not HAS_PWD:
        return None
    elif user is None:
        try:
            return os.geteuid()
        except AttributeError:
            return None
    else:
        try:
            return pwd.getpwnam(user).pw_uid
        except KeyError:
            return None
719787
def server(self):
        
        server = [s for s in self._server.resources() if s.clientIdentifier == self.machineIdentifier]
        if len(server) == 0:
            raise NotFound('Unable to find server with uuid %s' % self.machineIdentifier)
        return server[0]
176560
def info(self, uuid):
        
        args = {
            'uuid': uuid,
        }
        self._domain_action_chk.check(args)

        return self._client.json('kvm.info', args)
18502
def get_machine_id(machine, cwd):
    '''
    
    '''
    name = __utils__['sdb.sdb_get'](_build_machine_uri(machine, cwd), __opts__)
    return name
1068866
def get_system_uid():
    
    try:
        if os.name == 'nt':
            return get_nt_system_uid()
        if sys.platform == 'darwin':
            return get_osx_system_uid()
    except Exception:
        return get_mac_uid()
    else:
        return get_mac_uid()
1200778
def uuid(self):
		
		uuid_file = '/sys/block/%s/dm/uuid' % os.path.basename(os.path.realpath(self.volume_path()))
		lv_uuid = open(uuid_file).read().strip()
		if lv_uuid.startswith('LVM-') is True:
			return lv_uuid[4:]
		return lv_uuid
1313412
def get_metadata(self, refresh=True):
        
        if refresh or not self._metadata:
            ident = self._id or self.name
            if not ident:
                raise ConuException(
                    "This container does not have a valid identifier.")
            out = run_cmd(["machinectl", "--no-pager", "show", ident], return_output=True, ignore_status=True)
            if "Could not get path to machine" in out:
                self._metadata = {}
            else:
                self._metadata = convert_kv_to_dict(out)
        return self._metadata
612398
def client(self):
        
        if not self.app.config['DOCKER_URL']:
            raise RuntimeError('"DOCKER_URL" must be specified')

        if not self.app.extensions['docker.client']:
            self.app.extensions['docker.client'] = Client(
                base_url=self.app.config['DOCKER_URL'],
                version=self.app.config['DOCKER_VERSION'],
                timeout=self.app.config['DOCKER_TIMEOUT'],
                tls=make_tls_config(self.app.config))
        return self.app.extensions['docker.client']
1022364
def check_docker_access(self):
        
        try:
            if self.client is None:
                self.client = docker.from_env()
            self.client.ping()  # check that docker is running and user is permitted to access it
        except ConnectionError as e:
            logger.exception(e)
            raise BuildError("Docker is not running or the current user doesn't have permissions to access docker.")
458692
def get_networkid(vm_):
    '''
    
    '''
    networkid = config.get_cloud_config_value('networkid', vm_, __opts__)

    if networkid is not None:
        return networkid
    else:
        return False
926883
def get_server(self, UUID):
        
        server, IPAddresses, storages = self.get_server_data(UUID)

        return Server(
            server,
            ip_addresses=IPAddresses,
            storage_devices=storages,
            populated=True,
            cloud_manager=self
        )
458942
def getuname(self, uid):
        
        uid = int(uid)
        try:
            return self.uidsmap[uid]
        except KeyError:
            pass

        try:
            name = pwd.getpwuid(uid)[0]
        except (KeyError, AttributeError):
            name = "uid=%d" % uid

        self.uidsmap[uid] = name
        return name
1209175
def get(self, uid):
        
        r = requests.get(self.apiurl + "/users/{}".format(uid), headers=self.header)

        if r.status_code != 200:
            raise ServerError

        jsd = r.json()

        if jsd['data']:
            return jsd['data']
        else:
            return None
785663
def is_in_virtualbox():
  
  if not isfile(__VIRT_WHAT) or not access(__VIRT_WHAT, X_OK):
    raise IOError("virt-what not available")
  try:
    return subprocess.check_output(["sudo", "-n", __VIRT_WHAT]).split('\n')[0:2] == __VIRT_WHAT_VIRTUALBOX_WITH_KVM
  except subprocess.CalledProcessError as e:
    raise IOError("virt-what failed execution with {}".format(e))
1246006
def get_user_agent():
    

    global user_agent_string
    if user_agent_string is None:
        # get OS type
        try:
            sysinfo = subprocess.check_output('lsb_release -i -r -s'.split(' '))
            dockerinfo = subprocess.check_output('docker --version'.split(' '))

            user_agent_string = ' '.join([sysinfo.replace('\t','/'),
                                          dockerinfo.replace(" version ", "/").replace(", ", "/").replace(' ', '/')]).replace('\n','')
        except:
            user_agent_string = None

    return user_agent_string