コード例 #1
0
ファイル: __init__.py プロジェクト: msanchezt/lxc
def list_containers(active=True,
                    defined=True,
                    as_object=False,
                    config_path=None):
    """
        List the containers on the system.
    """

    if config_path:
        if not os.path.exists(config_path):
            return tuple()
        try:
            entries = _lxc.list_containers(active=active,
                                           defined=defined,
                                           config_path=config_path)
        except ValueError:
            return tuple()
    else:
        try:
            entries = _lxc.list_containers(active=active, defined=defined)
        except ValueError:
            return tuple()

    if as_object:
        return tuple([Container(name, config_path) for name in entries])
    else:
        return entries
コード例 #2
0
ファイル: __init__.py プロジェクト: heiden-deng/lxc
def list_containers(active=True, defined=True,
                    as_object=False, config_path=None):
    """
        List the containers on the system.
    """

    if config_path:
        entries = _lxc.list_containers(active=active, defined=defined,
                                       config_path=config_path)
    else:
        entries = _lxc.list_containers(active=active, defined=defined)

    if as_object:
        return tuple([Container(name, config_path) for name in entries])
    else:
        return entries
コード例 #3
0
ファイル: lxc-ui.py プロジェクト: pymag09/lxc-ui
def my_list_containers(active=True, defined=True, as_object=False, config_path=None):
    """
    List the containers on the system.
    This function from original lxc library. It is rewrited to work with new class
    """
    if config_path:
        if not os.path.exists(config_path):
            return tuple()
        try:
            entries = _lxc.list_containers(active=active, defined=defined, config_path=config_path)
        except ValueError:
            return tuple()
    else:
        try:
            entries = _lxc.list_containers(active=active, defined=defined)
        except ValueError:
            return tuple()
    if as_object:
        return tuple([BugContainer(name, config_path) for name in entries])
    else:
        return entries
コード例 #4
0
ファイル: __init__.py プロジェクト: skizhak/lxc
def list_containers(active=True, defined=True,
                    as_object=False, config_path=None):
    """
        List the containers on the system.
    """

    if config_path:
        if not os.path.exists(config_path):
            return tuple()
        try:
            entries = _lxc.list_containers(active=active, defined=defined,
                                           config_path=config_path)
        except ValueError:
            return tuple()
    else:
        try:
            entries = _lxc.list_containers(active=active, defined=defined)
        except ValueError:
            return tuple()

    if as_object:
        return tuple([Container(name, config_path) for name in entries])
    else:
        return entries