コード例 #1
0
ファイル: test_lxc.py プロジェクト: simhaonline/yurt
    def test_delete(self):
        instance_name = f"test-instance-{util.random_string()}"
        lxc.launch("images:alpine/3.10", instance_name)
        lxc.stop([instance_name])
        lxc.delete([instance_name])

        instance = util.find(lambda i: i["Name"] == instance_name, lxc.list_(),
                             None)
        self.assertIsNone(instance)
コード例 #2
0
ファイル: test_lxc.py プロジェクト: simhaonline/yurt
    def test_stop(self):
        instance_name = f"test-instance-{util.random_string()}"
        lxc.launch("images:alpine/3.10", instance_name)

        logging.info(f"Test stop: {instance_name}.")
        lxc.stop([instance_name])
        instance = util.find(
            lambda i: i["Name"] == instance_name and i["Status"] == "Stopped",
            lxc.list_(), None)
        self.assertIsNotNone(instance)
コード例 #3
0
    def test_stop(self):
        util.mark("test_stop")

        instance_name = util.generate_instance_name()
        lxc.launch("images", "alpine/3.10", instance_name)

        lxc.stop([instance_name])
        instance = yurt_util.find(
            lambda i: i["Name"] == instance_name and i["Status"] == "Stopped",
            lxc.list_(),
            None
        )
        self.assertIsNotNone(instance)
コード例 #4
0
    def test_delete(self):
        util.mark("test_delete")

        instance_name = util.generate_instance_name()
        lxc.launch("images", "alpine/3.10", instance_name)
        lxc.stop([instance_name])
        lxc.delete([instance_name])

        instance = yurt_util.find(
            lambda i: i["Name"] == instance_name,
            lxc.list_(),
            None
        )
        self.assertIsNone(instance)
コード例 #5
0
def stop(instances):
    """
    Stop one or more containers.
    """

    full_help_if_missing(instances)

    try:
        vm.ensure_is_ready()

        click.echo(lxc.stop(list(instances)))

    except YurtException as e:
        logging.error(e.message)
コード例 #6
0
ファイル: cli.py プロジェクト: simhaonline/yurt
def stop(instances, force):
    """
    Stop an instance.
    """

    full_help_if_missing(instances)

    try:
        vm.ensure_is_ready()

        click.echo(lxc.stop(list(instances), force=force))

    except YurtException as e:
        logging.error(e.message)