From 81b89dc3ce15e65c6a605723c270e73b63d624dc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 24 Oct 2022 02:06:09 +0200 Subject: [PATCH] Improving ynh_lxc_reset --- lib/ynh_lxd | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/ynh_lxd b/lib/ynh_lxd index 5d31a00..22b1a09 100644 --- a/lib/ynh_lxd +++ b/lib/ynh_lxd @@ -491,15 +491,9 @@ ynh_lxc_reset () { then # Remove swap files before deleting the container ynh_lxc_swapfiles_clean --name=$name - fi - - ynh_lxc_stop --name=$name - - if ynh_lxc_exists --name=$name - then + ynh_lxc_stop --name=$name local current_storage=$(lxc list $name --format json --columns b | jq '.[].expanded_devices.root.pool') swapoff "$(lxc storage get $current_storage source)/containers/$name/rootfs/swap" 2>/dev/null + ynh_lxc_delete --name=$name fi - - lxc delete $name --force 2>/dev/null }