Browse Source

Improved logic for remove and purge

release/v3.3.0
gau1991 10 years ago
parent
commit
54ed4e61c4
  1. 22
      ee/cli/plugins/stack.py

22
ee/cli/plugins/stack.py

@ -1788,27 +1788,27 @@ class EEStackController(CementBaseController):
'/usr/bin/pt-query-advisor', '/usr/bin/pt-query-advisor',
'{0}22222/htdocs/db/anemometer' '{0}22222/htdocs/db/anemometer'
.format(EEVariables.ee_webroot)] .format(EEVariables.ee_webroot)]
if len(packages) or len(apt_packages):
ee_prompt = input('Are you sure you to want to' ee_prompt = input('Are you sure you to want to'
' remove from server.' ' remove from server.'
'Package configuration will remain' '\nPackage configuration will remain'
' on server after this operation.\n' ' on server after this operation.\n'
'Any answer other than ' 'Any answer other than '
'"yes" will be stop this' '"yes" will be stop this'
' operation : ') ' operation : ')
if len(apt_packages):
if ee_prompt == 'YES' or ee_prompt == 'yes': if ee_prompt == 'YES' or ee_prompt == 'yes':
if len(packages):
EEFileUtils.remove(self, packages)
EEAptGet.auto_remove(self)
if len(apt_packages):
Log.debug(self, "Removing apt_packages") Log.debug(self, "Removing apt_packages")
Log.info(self, "Removing packages, please wait...") Log.info(self, "Removing packages, please wait...")
EEAptGet.remove(self, apt_packages) EEAptGet.remove(self, apt_packages)
EEAptGet.auto_remove(self) EEAptGet.auto_remove(self)
if len(packages):
if ee_prompt == 'YES' or ee_prompt == 'yes':
EEFileUtils.remove(self, packages)
EEAptGet.auto_remove(self)
if ee_prompt == 'YES' or ee_prompt == 'yes':
Log.info(self, "Successfully removed packages") Log.info(self, "Successfully removed packages")
@expose(help="Purge packages") @expose(help="Purge packages")
@ -1919,6 +1919,7 @@ class EEStackController(CementBaseController):
.format(EEVariables.ee_webroot) .format(EEVariables.ee_webroot)
] ]
if len(apt_packages) or len(apt_packages):
ee_prompt = input('Are you sure you to want to purge ' ee_prompt = input('Are you sure you to want to purge '
'from server ' 'from server '
'along with their configuration' 'along with their configuration'
@ -1926,21 +1927,18 @@ class EEStackController(CementBaseController):
'"yes" will be stop this ' '"yes" will be stop this '
'operation :') 'operation :')
if len(apt_packages):
if ee_prompt == 'YES' or ee_prompt == 'yes': if ee_prompt == 'YES' or ee_prompt == 'yes':
if len(apt_packages):
Log.info(self, "Purging packages, please wait...") Log.info(self, "Purging packages, please wait...")
EEAptGet.remove(self, apt_packages, purge=True) EEAptGet.remove(self, apt_packages, purge=True)
EEAptGet.auto_remove(self) EEAptGet.auto_remove(self)
if len(packages): if len(packages):
if ee_prompt == 'YES' or ee_prompt == 'yes':
EEFileUtils.remove(self, packages) EEFileUtils.remove(self, packages)
EEAptGet.auto_remove(self) EEAptGet.auto_remove(self)
if ee_prompt == 'YES' or ee_prompt == 'yes':
Log.info(self, "Successfully purged packages") Log.info(self, "Successfully purged packages")
def load(app): def load(app):
# register the plugin class.. this only happens if the plugin is enabled # register the plugin class.. this only happens if the plugin is enabled
handler.register(EEStackController) handler.register(EEStackController)

Loading…
Cancel
Save