Browse Source

Improved logic for remove and purge

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

68
ee/cli/plugins/stack.py

@ -1788,28 +1788,28 @@ 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)]
ee_prompt = input('Are you sure you to want to'
' remove from server.'
'Package configuration will remain'
' on server after this operation.\n'
'Any answer other than '
'"yes" will be stop this'
' operation : ')
if len(apt_packages): if len(packages) or len(apt_packages):
if ee_prompt == 'YES' or ee_prompt == 'yes': ee_prompt = input('Are you sure you to want to'
Log.debug(self, "Removing apt_packages") ' remove from server.'
Log.info(self, "Removing packages, please wait...") '\nPackage configuration will remain'
EEAptGet.remove(self, apt_packages) ' on server after this operation.\n'
EEAptGet.auto_remove(self) 'Any answer other than '
'"yes" will be stop this'
' operation : ')
if len(packages):
if ee_prompt == 'YES' or ee_prompt == 'yes': if ee_prompt == 'YES' or ee_prompt == 'yes':
EEFileUtils.remove(self, packages) if len(packages):
EEAptGet.auto_remove(self) EEFileUtils.remove(self, packages)
EEAptGet.auto_remove(self)
if len(apt_packages):
Log.debug(self, "Removing apt_packages")
Log.info(self, "Removing packages, please wait...")
EEAptGet.remove(self, apt_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")
def purge(self): def purge(self):
@ -1919,27 +1919,25 @@ class EEStackController(CementBaseController):
.format(EEVariables.ee_webroot) .format(EEVariables.ee_webroot)
] ]
ee_prompt = input('Are you sure you to want to purge ' if len(apt_packages) or len(apt_packages):
'from server ' ee_prompt = input('Are you sure you to want to purge '
'alongwith their configuration' 'from server '
' packages,\nAny answer other than ' 'along with their configuration'
'"yes" will be stop this ' ' packages,\nAny answer other than '
'operation :') '"yes" will be stop this '
'operation :')
if len(apt_packages):
if ee_prompt == 'YES' or ee_prompt == 'yes':
Log.info(self, "Purging packages, please wait...")
EEAptGet.remove(self, apt_packages, purge=True)
EEAptGet.auto_remove(self)
if len(packages):
if ee_prompt == 'YES' or ee_prompt == 'yes': if ee_prompt == 'YES' or ee_prompt == 'yes':
EEFileUtils.remove(self, packages) if len(apt_packages):
EEAptGet.auto_remove(self) Log.info(self, "Purging packages, please wait...")
EEAptGet.remove(self, apt_packages, purge=True)
EEAptGet.auto_remove(self)
if ee_prompt == 'YES' or ee_prompt == 'yes': if len(packages):
Log.info(self, "Successfully purged packages") EEFileUtils.remove(self, packages)
EEAptGet.auto_remove(self)
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

Loading…
Cancel
Save