Lists running nspawn containers

    .. note::

        ``nspawn.list`` also works to list running containers

    CLI Example:

    .. code-block:: bash

        salt myminion nspawn.list_running
        salt myminion nspawn.list
497039
def list_running():
    '''
    
    '''
    ret = []
    for line in _machinectl('list')['stdout'].splitlines():
        try:
            ret.append(line.split()[0])
        except IndexError:
            pass
    return sorted(ret)
661958
def list_storage_containers(kwargs=None, storage_conn=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_storage_containers function must be called with -f or --function.'
        )

    if not storage_conn:
        storage_conn = get_storage_conn(conn_kwargs=kwargs)

    data = storage_conn.list_containers()
    ret = {}
    for item in data.containers:
        ret[item.name] = object_to_dict(item)
    return ret
619365
def list_mount():
    '''
    

    '''
    ## List mounted filesystem
    res = __salt__['cmd.run_all'](
        __utils__['zfs.zfs_command'](
            command='mount',
        ),
        python_shell=False,
    )

    if res['retcode'] == 0:
        ret = OrderedDict()
        for mount in res['stdout'].splitlines():
            mount = mount.split()
            ret[mount[0]] = mount[-1]
        return ret
    else:
        return __utils__['zfs.parse_command_result'](res)
1299889
def file_list(load):
    '''
    
    '''
    ret = set()
    try:
        for container in __opts__['azurefs']:
            if container.get('saltenv', 'base') != load['saltenv']:
                continue
            container_list = _get_container_path(container) + '.list'
            lk = container_list + '.lk'
            salt.fileserver.wait_lock(lk, container_list, 5)
            if not os.path.exists(container_list):
                continue
            with salt.utils.files.fopen(container_list, 'r') as fp_:
                ret.update(set(salt.utils.json.load(fp_)))
    except Exception as exc:
        log.error('azurefs: an error ocurred retrieving file lists. '
                  'It should be resolved next time the fileserver '
                  'updates. Please do not manually modify the azurefs '
                  'cache directory.')
    return list(ret)
1008593
def _run_proxy_processes(proxies):
    '''
    
    '''
    ret = []
    for proxy in proxies:
        result = {}
        if not __salt__['salt_proxy.is_running'](proxy)['result']:
            __salt__['salt_proxy.configure_proxy'](proxy, start=True)
            result[proxy] = 'Proxy {0} was started'.format(proxy)
        else:
            msg = 'Proxy {0} is already running'.format(proxy)
            result[proxy] = msg
            log.debug(msg)
        ret.append(result)
    return ret
542724
def internal_run_container(name, callback_method, foreground=False):
        
        if not foreground:
            logger.info("Stating machine (boot nspawn container) {}".format(name))
            # wait until machine is booted when running at background, unable to execute commands without logind
            # in running container
            nspawn_process = NspawnContainer._internal_reschedule(callback_method)
            NspawnContainer._wait_for_machine_booted(name)
            logger.info("machine: %s starting finished" % name)
            return nspawn_process
        else:
            logger.info("Stating machine (return process) {}".format(name))
            return callback_method[0](callback_method[1], *callback_method[2], **callback_method[3])
1242708
def list(self):
    
    import IPython

    # "self" is iterable (see __iter__() method).
    data = [{'name': version['name'].split()[-1],
             'deploymentUri': version['deploymentUri'], 'createTime': version['createTime']}
            for version in self.get_iterator()]
    IPython.display.display(
        datalab.utils.commands.render_dictionary(data, ['name', 'deploymentUri', 'createTime']))
462913
def listRuns(self, run_num=-1, logical_file_name="",
                 block_name="", dataset=""):
        
        if( '%' in logical_file_name or '%' in block_name or '%' in dataset ):
            dbsExceptionHandler('dbsException-invalid-input', 
                                " DBSDatasetRun/listRuns. No wildcards are allowed in logical_file_name, block_name or dataset.\n.")
        conn = self.dbi.connection()
        tran = False
        try:
            ret = self.runlist.execute(conn, run_num, logical_file_name, block_name, dataset, tran)
            result = []
            rnum = []
            for i in ret:
                rnum.append(i['run_num'])
            result.append({'run_num' : rnum})
            return result

        finally:
            if conn:
                conn.close()
990469
def list_available_plugins(runas=None):
    '''
        
        '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    cmd = [_get_rabbitmq_plugin(), 'list', '-m']
    ret = __salt__['cmd.run_all'](cmd, reset_system_locale=False, python_shell=False, runas=runas)
    _check_response(ret)
    return _output_to_list(ret['stdout'])
772695
def list(self, limit=None, marker=None, end_marker=None, prefix=None):
        
        return self._manager.list(limit=limit, marker=marker,
                end_marker=end_marker, prefix=prefix)
991400
def cleanup_containers(self, include_initial=False, exclude=None, **kwargs):
        
        self.push_log("Generating list of stopped containers.")
        set_raise_on_error(kwargs, False)
        return super(DockerFabricClient, self).cleanup_containers(include_initial=include_initial, exclude=exclude,
                                                                  **kwargs)
801270
def ThreadsWithRunningExecServers(self):
    """"""
    socket_dir = '/tmp/pyringe_%s' % self.inferior.pid
    if os.path.isdir(socket_dir):
      return [int(fname[:-9])
              for fname in os.listdir(socket_dir)
              if fname.endswith('.execsock')]
    return []
898525
def list_users(runas=None):
    '''
    
    '''
    # Windows runas currently requires a password.
    # Due to this, don't use a default value for
    # runas in Windows.
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_users', '-q'],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)

    # func to get tags from string such as "[admin, monitoring]"
    func = lambda string: [x.strip() for x in string[1:-1].split(',')] if ',' in string else [x for x in
                                                                                              string[1:-1].split(' ')]
    return _output_to_dict(res, func)
251254
def run_list():
    
    term = TerminalView()
    term.print_info("These are the available templates:")
    import pkgutil, projy.templates
    pkgpath = os.path.dirname(projy.templates.__file__)
    templates = [name for _, name, _ in pkgutil.iter_modules([pkgpath])]
    for name in templates:
        # the father of all templates, not a real usable one
        if (name != 'ProjyTemplate'):
            term.print_info(term.text_in_color(template_name_from_class_name(name), TERM_PINK))
1271252
def do_list(self, line):
        
        path = self._split_args(line, 0, 1, pad=False)
        if len(path):
            path = path[0]
        self._command_processor.list_objects(path)
559566
def get_containers(config,
                   all=True,
                   trunc=False,
                   since=None,
                   before=None,
                   limit=-1,
                   *args,
                   **kwargs):
    '''
    
    '''
    err = "Unknown"
    client = _get_client(config)
    try:
        ret = client.containers(all=all,
                                trunc=trunc,
                                since=since,
                                before=before,
                                limit=limit)
        return ret
    except Exception as e:
        err = e
    utils.error("Unable to list Docker containers: %s"%err)
    return None
936073
def docker_list(registry_pass):
    # type: (str) -> None
    
    registry = conf.get('docker.registry', None)

    if registry is None:
        log.err("You must define docker.registry conf variable to list images")
        sys.exit(-1)

    registry_user = conf.get('docker.registry_user', None)

    if registry_user is None:
        registry_user = click.prompt("Username")

    rc = client.RegistryClient(registry, registry_user, registry_pass)
    images = {x: rc.list_tags(x) for x in rc.list_images()}

    shell.cprint("<32>Images in <34>{} <32>registry:", registry)
    for image, tags in images.items():
        shell.cprint('  <92>{}', image)
        for tag in tags:
            shell.cprint('      <90>{}:<35>{}', image, tag)