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)
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)
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)
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)
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)
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)