Пример #1
0
def stopContainer(name):
    try:
        container = LXCContainer({'name': name})
        ephemeral = container.info()['ephemeral']
        container.stop()
        if ephemeral:
            return response.replySuccess(data={}, message='success')
        return response.replySuccess(container.info())
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
Пример #2
0
def stopContainer(name):
    try:
        container = LXCContainer({'name': name})
        ephemeral = container.info()['ephemeral']
        container.stop()
        if ephemeral:
            return response.replySuccess(container.info(), message='Container {} stopped successfully.'.format(name))
        return response.replySuccess(container.info(), message='Container {} stopped successfully.'.format(name))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
Пример #3
0
def startContainer(name):
    try:
        container = LXCContainer({'name': name})
        container.start()
        return response.replySuccess(container.info())
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
Пример #4
0
def unfreezeContainer(name):
    try:
        container = LXCContainer({'name': name})
        container.unfreeze()
        return response.replySuccess(container.info(), message='Container {} is unfrozen.'.format(name))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
Пример #5
0
def restartContainer(name):
    try:
        container = LXCContainer({'name': name})
        container.restart()
        return response.replySuccess(container.info(), message='Container {} restarted successfully.'.format(name))
    except ValueError as e:
        return response.replyFailed(message=e.__str__())
Пример #6
0
def containers():
    client = LXDModule()
    result = []
    containers = client.listContainers()
    for container in containers:
        c = LXCContainer({'name': container.get('name')})
        result.append(c.info())
    return response.reply(result)
Пример #7
0
def containerDetails(name):
    try:
        container = LXCContainer({'name': name})
        return render_template('container-details.html', currentpage='Container Details',
                               container=container.info(),
                               profiles = getProfiles(),
                               lxdui_current_version=VERSION)
    except ValueError as ex:
        return render_template('container-details.html', currentpage='Container Details',
                               container=None,
                               name=name,
                               message=ex.__str__(),
                               lxdui_current_version=VERSION)
Пример #8
0
def container():
    try:
        containers = LXDModule().listContainers()
        result = []
        for container in containers:
            c = LXCContainer({'name': container.get('name')})
            result.append(c.info())
        images = LXDModule().listLocalImages()
        profiles = LXDModule().listProfiles()
        return render_template('containers.html', currentpage='Containers',
                               containers=result,
                               images = images,
                               profiles = profiles,
                               memory=memory(),
                               lxdui_current_version=VERSION)
    except:
        return render_template('containers.html', currentpage='Containers',
                               containers=[],
                               images=[],
                               profiles=[],
                               memory=memory(),
                               lxdui_current_version=VERSION)