From 5919719f3efa24e0688a5044e7fb2b2ad5fbedc3 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Wed, 31 Oct 2018 13:56:59 +0100 Subject: [PATCH] Clean log and autostart on uninstall --- basic/srv/vm/mgr/appmgr.py | 5 +++++ ckan/uninstall.sh | 1 - crisiscleanup/uninstall.sh | 1 - cts/uninstall.sh | 1 - frontlinesms/uninstall.sh | 1 - gnuhealth/uninstall.sh | 1 - kanboard/uninstall.sh | 1 - mifosx/uninstall.sh | 1 - motech/uninstall.sh | 1 - opendatakit-build/uninstall.sh | 1 - opendatakit/uninstall.sh | 1 - openmapkit/uninstall.sh | 1 - pandora/uninstall.sh | 1 - sahana-demo/uninstall.sh | 1 - sahana/uninstall.sh | 1 - sambro/uninstall.sh | 1 - seeddms/uninstall.sh | 1 - sigmah/uninstall.sh | 1 - ushahidi/uninstall.sh | 1 - 19 files changed, 5 insertions(+), 18 deletions(-) diff --git a/basic/srv/vm/mgr/appmgr.py b/basic/srv/vm/mgr/appmgr.py index 4d31c24..5338097 100644 --- a/basic/srv/vm/mgr/appmgr.py +++ b/basic/srv/vm/mgr/appmgr.py @@ -122,6 +122,8 @@ class AppMgr: def uninstall_app(self, item): # Main uninstallation function. Wrapper for uninstall script, filesystem purge and unregistration self.stop_app(item) + if tools.is_service_autostarted(item.app): + self.vmmgr.disable_autostart(item.app) deps = self.get_install_deps(item.app, False)[::-1] for dep in deps: if dep not in self.get_uninstall_deps(): @@ -155,6 +157,9 @@ class AppMgr: srv_dir = os.path.join('/srv/', name) if os.path.exists(srv_dir): shutil.rmtree(srv_dir) + lxc_log = '/var/log/lxc/{}.log'.format(name) + if os.path.exists(lxc_log): + os.unlink(lxc_log) def register_package(self, name): # Registers a package in local configuration diff --git a/ckan/uninstall.sh b/ckan/uninstall.sh index 78c36d0..5b24c38 100755 --- a/ckan/uninstall.sh +++ b/ckan/uninstall.sh @@ -5,7 +5,6 @@ set -ev rm -f /etc/periodic/hourly/ckan # Remove service -rc-update del ckan || true rm -f /etc/init.d/ckan rc-update -u diff --git a/crisiscleanup/uninstall.sh b/crisiscleanup/uninstall.sh index 704bae2..8100ced 100755 --- a/crisiscleanup/uninstall.sh +++ b/crisiscleanup/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del crisiscleanup || true rm -f /etc/init.d/crisiscleanup rc-update -u diff --git a/cts/uninstall.sh b/cts/uninstall.sh index 3824d9e..c66b38e 100755 --- a/cts/uninstall.sh +++ b/cts/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del cts || true rm -f /etc/init.d/cts rc-update -u diff --git a/frontlinesms/uninstall.sh b/frontlinesms/uninstall.sh index 3f7b0f0..b535bc4 100755 --- a/frontlinesms/uninstall.sh +++ b/frontlinesms/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del frontlinesms || true rm -f /etc/init.d/frontlinesms rc-update -u diff --git a/gnuhealth/uninstall.sh b/gnuhealth/uninstall.sh index b737e58..8152bce 100755 --- a/gnuhealth/uninstall.sh +++ b/gnuhealth/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del gnuhealth || true rm -f /etc/init.d/gnuhealth rc-update -u diff --git a/kanboard/uninstall.sh b/kanboard/uninstall.sh index 847a64f..5f7c4f0 100755 --- a/kanboard/uninstall.sh +++ b/kanboard/uninstall.sh @@ -5,7 +5,6 @@ set -ev rm -f /etc/periodic/daily/kanboard # Remove service -rc-update del kanboard || true rm -f /etc/init.d/kanboard rc-update -u diff --git a/mifosx/uninstall.sh b/mifosx/uninstall.sh index bf68ad2..94d4684 100755 --- a/mifosx/uninstall.sh +++ b/mifosx/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del mifosx || true rm -f /etc/init.d/mifosx rc-update -u diff --git a/motech/uninstall.sh b/motech/uninstall.sh index af9f22a..2d50d3e 100755 --- a/motech/uninstall.sh +++ b/motech/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del motech || true rm -f /etc/init.d/motech rc-update -u diff --git a/opendatakit-build/uninstall.sh b/opendatakit-build/uninstall.sh index 96da8c1..2eccf7c 100755 --- a/opendatakit-build/uninstall.sh +++ b/opendatakit-build/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del opendatakit-build || true rm -f /etc/init.d/opendatakit-build rc-update -u diff --git a/opendatakit/uninstall.sh b/opendatakit/uninstall.sh index f98fe47..9d45746 100755 --- a/opendatakit/uninstall.sh +++ b/opendatakit/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del opendatakit || true rm -f /etc/init.d/opendatakit rc-update -u diff --git a/openmapkit/uninstall.sh b/openmapkit/uninstall.sh index d082623..b30da54 100755 --- a/openmapkit/uninstall.sh +++ b/openmapkit/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del openmapkit || true rm -f /etc/init.d/openmapkit rc-update -u diff --git a/pandora/uninstall.sh b/pandora/uninstall.sh index 0f43dea..8d2247c 100755 --- a/pandora/uninstall.sh +++ b/pandora/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del pandora || true rm -f /etc/init.d/pandora rc-update -u diff --git a/sahana-demo/uninstall.sh b/sahana-demo/uninstall.sh index d5b12aa..bd2d886 100755 --- a/sahana-demo/uninstall.sh +++ b/sahana-demo/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del sahana-demo || true rm -f /etc/init.d/sahana-demo rc-update -u diff --git a/sahana/uninstall.sh b/sahana/uninstall.sh index 7667fd8..1b3c0fa 100755 --- a/sahana/uninstall.sh +++ b/sahana/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del sahana || true rm -f /etc/init.d/sahana rc-update -u diff --git a/sambro/uninstall.sh b/sambro/uninstall.sh index 8a9aca7..5558d98 100755 --- a/sambro/uninstall.sh +++ b/sambro/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del sambro || true rm -f /etc/init.d/sambro rc-update -u diff --git a/seeddms/uninstall.sh b/seeddms/uninstall.sh index a1a47ef..c1c3953 100755 --- a/seeddms/uninstall.sh +++ b/seeddms/uninstall.sh @@ -5,7 +5,6 @@ set -ev rm -f /etc/periodic/hourly/seeddms # Remove service -rc-update del seeddms || true rm -f /etc/init.d/seeddms rc-update -u diff --git a/sigmah/uninstall.sh b/sigmah/uninstall.sh index 81f0e63..7b74804 100755 --- a/sigmah/uninstall.sh +++ b/sigmah/uninstall.sh @@ -2,7 +2,6 @@ set -ev # Remove service -rc-update del sigmah || true rm -f /etc/init.d/sigmah rc-update -u diff --git a/ushahidi/uninstall.sh b/ushahidi/uninstall.sh index d4b2d26..4f3e1fc 100755 --- a/ushahidi/uninstall.sh +++ b/ushahidi/uninstall.sh @@ -5,7 +5,6 @@ set -ev rm -f /etc/periodic/15min/ushahidi # Remove service -rc-update del ushahidi || true rm -f /etc/init.d/ushahidi rc-update -u