From 6fdb0e1e4cc28c84aac1493e550f0bce0b343d6c Mon Sep 17 00:00:00 2001 From: suvendhu Date: Thu, 30 Nov 2023 12:58:12 +0530 Subject: [PATCH] swmodd: fix DUStateChange event for lxc --- swmodd/files/etc/init.d/crun | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/swmodd/files/etc/init.d/crun b/swmodd/files/etc/init.d/crun index 5b6c6afd6..cf029c8a0 100644 --- a/swmodd/files/etc/init.d/crun +++ b/swmodd/files/etc/init.d/crun @@ -34,7 +34,17 @@ configure_lxc_container() { if [ -d "${BUNDLE:?}/${name:?}" ]; then rm -rf "${BUNDLE:?}/${name:?}" fi - uci_remove ocicontainer "${section}" + + # If directory still exists then uninstall failed + if [ -d "${BUNDLE}/${name}" ]; then + uci_set ocicontainer "${section}" du_status Uninstalling_failed + uci_set ocicontainer "${section}" fault_string "Failed to remove ${BUNDLE}/${name}" + log "LXC container ${name} remove failed" + else + uci_set ocicontainer "${section}" du_status Uninstalling_success + log "LXC container ${name} removed" + fi + return 0; fi