From 9cb97cdba9324033dd7d15babef52aa162bdce66 Mon Sep 17 00:00:00 2001 From: shitalp Date: Tue, 14 Apr 2015 19:21:46 +0530 Subject: [PATCH] Fixed issue #485 --- ee/cli/plugins/stack.py | 46 +++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index b5d678a0..b3a3c09a 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1667,13 +1667,25 @@ class EEStackController(CementBaseController): .format(EEVariables.ee_webroot)] if len(apt_packages): - Log.debug(self, "Removing apt_packages") - Log.info(self, "Uninstalling packages, please wait ...") - EEAptGet.remove(self, apt_packages) - EEAptGet.auto_remove(self) + if not self.app.pargs.no_prompt: + ee_apt_pkg_prompt = input('Are you sure, you want to remove' + ' packages [y/N]: ') + else: + ee_apt_pkg_prompt = 'Y' + if ee_apt_pkg_prompt == 'Y' or ee_apt_pkg_prompt == 'y': + Log.debug(self, "Removing apt_packages") + Log.info(self, "Uninstalling packages, please wait ...") + EEAptGet.remove(self, apt_packages) + EEAptGet.auto_remove(self) if len(packages): - EEFileUtils.remove(self, packages) - EEAptGet.auto_remove(self) + if not self.app.pargs.no_prompt: + ee_pkg_prompt = input('Are you sure, you want to remove' + ' packages [y/N]: ') + else: + ee_pkg_prompt = 'Y' + if ee_pkg_prompt == 'Y' or ee_pkg_prompt == 'y': + EEFileUtils.remove(self, packages) + EEAptGet.auto_remove(self) Log.info(self, "Successfully removed packages") @expose(help="Purge packages") @@ -1768,12 +1780,24 @@ class EEStackController(CementBaseController): ] if len(apt_packages): - Log.info(self, "Uninstalling packages, please wait ...") - EEAptGet.remove(self, apt_packages, purge=True) - EEAptGet.auto_remove(self) + if not self.app.pargs.no_prompt: + ee_apt_pkg_prompt = input('Are you sure, you want to remove' + ' packages [y/N]: ') + else: + ee_apt_pkg_prompt = 'Y' + if ee_apt_pkg_prompt == 'Y' or ee_apt_pkg_prompt == 'y': + Log.info(self, "Uninstalling packages, please wait ...") + EEAptGet.remove(self, apt_packages, purge=True) + EEAptGet.auto_remove(self) if len(packages): - EEFileUtils.remove(self, packages) - EEAptGet.auto_remove(self) + if not self.app.pargs.no_prompt: + ee_pkg_prompt = input('Are you sure, you want to remove' + ' packages [y/N]: ') + else: + ee_pkg_prompt = 'Y' + if ee_pkg_prompt == 'Y' or ee_pkg_prompt == 'y': + EEFileUtils.remove(self, packages) + EEAptGet.auto_remove(self) Log.info(self, "Successfully purged packages")