From 22ddac1cbad155981a13cb39bb9c60365b23965a Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Mon, 11 Jan 2016 20:27:50 +0530 Subject: [PATCH] install && remove nginx, nginx-mainline in single command --- ee/cli/plugins/stack.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 60a3349a..9424a935 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1693,11 +1693,21 @@ class EEStackController(CementBaseController): self.post_pref(apt, packages) else: Log.debug(self, "Nginx already installed") - Log.info(self, "Nginx already installed") + if EEAptGet.is_installed(self, 'nginx-mainline'): + ee_prompt = input('Nginx Stable already found on your system.\nDo you want to remove Nginx mainline ' + 'and install Nginx Stable.,\nAny answer other than "yes" will be stop this ' + 'operation :') + if ee_prompt == 'YES' or ee_prompt == 'yes': + EEService.stop_service(self, 'nginx') + Log.debug(self, "Removing apt_packages variable of Nginx") + EEFileUtils.remove(self, EEVariables.ee_nginx_dev) + EEAptGet.auto_remove(self) + Log.info(self, "Removing repository for NGINX MAINLINE,") + EERepo.remove(self, repo_url=EEVariables.ee_nginx_dev_repo) if self.app.pargs.nginxmainline: if EEVariables.ee_nginx_dev_repo == None: - Log.error(self, "NGINX Mainline Version is not supported in wheezy") + Log.error(self, "NGINX Mainline Version is not supported in your platform") Log.debug(self, "Setting apt_packages variable for Nginx") @@ -1711,7 +1721,17 @@ class EEStackController(CementBaseController): self.post_pref(apt, packages) else: Log.debug(self, "Nginx already installed") - Log.info(self, "Nginx already installed") + if EEAptGet.is_installed(self, 'nginx-custom'): + ee_prompt = input('Nginx Stable already found on your system.\nDo you want to remove Nginx stable ' + 'and install Nginx Mainline.,\nAny answer other than "yes" will be stop this ' + 'operation :') + if ee_prompt == 'YES' or ee_prompt == 'yes': + EEService.stop_service(self, 'nginx') + Log.debug(self, "Removing apt_packages variable of Nginx") + EEFileUtils.remove(self, EEVariables.ee_nginx) + EEAptGet.auto_remove(self) + + if self.app.pargs.php: Log.debug(self, "Setting apt_packages variable for PHP")