예제 #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