Browse Source

redirected apt cache update logs to log file

bugfixes
harshadyeola 10 years ago
parent
commit
9c524ec3cb
  1. 4
      ee/cli/plugins/site.py
  2. 35
      ee/core/aptget.py

4
ee/cli/plugins/site.py

@ -1,4 +1,4 @@
"""EasyEngine site controller.""" # """EasyEngine site controller."""
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
from cement.core import handler, hook from cement.core import handler, hook
from ee.core.variables import EEVariables from ee.core.variables import EEVariables
@ -913,7 +913,7 @@ class EESiteUpdateController(CementBaseController):
msg="{0} updated with {1} {2}" msg="{0} updated with {1} {2}"
.format(ee_www_domain, stype, cache)) .format(ee_www_domain, stype, cache))
# Setup Permissions for webroot # Setup Permissions for webroot
# setwebrootpermissions(self, data['webroot']) setwebrootpermissions(self, data['webroot'])
if ee_auth and len(ee_auth): if ee_auth and len(ee_auth):
for msg in ee_auth: for msg in ee_auth:
Log.info(self, Log.ENDC + msg) Log.info(self, Log.ENDC + msg)

35
ee/core/aptget.py

@ -15,15 +15,19 @@ class EEAptGet():
""" """
try: try:
apt_cache = apt.cache.Cache() apt_cache = apt.cache.Cache()
apt_cache.update() import sys
success = (apt_cache.commit( orig_out = sys.stdout
apt.progress.text.AcquireProgress(), sys.stdout = open(self.app.config.get('log.logging', 'file'), 'a')
apt.progress.base.InstallProgress())) apt_cache.update(apt.progress.text.AcquireProgress())
#apt_cache.close() sys.stdout = orig_out
return success # success = (apt_cache.commit(
# apt.progress.text.AcquireProgress(),
# apt.progress.base.InstallProgress()))
# #apt_cache.close()
# return success
except AttributeError as e: except AttributeError as e:
Log.error(self, 'AttributeError: ' + str(e)) Log.error(self, 'AttributeError: ' + str(e))
except FetchFailedException as e: except Exception as e:
Log.debug(self, 'SystemError: ' + str(e)) Log.debug(self, 'SystemError: ' + str(e))
Log.error(self, 'Unable to Fetch update') Log.error(self, 'Unable to Fetch update')
@ -85,7 +89,12 @@ class EEAptGet():
if apt_cache.install_count > 0: if apt_cache.install_count > 0:
try: try:
#apt_pkg.PkgSystemUnLock() #apt_pkg.PkgSystemUnLock()
result = apt_cache.commit() orig_out = sys.stdout
sys.stdout = open(self.app.config.get('log.logging', 'file'),
'a')
result = apt_cache.commit(apt.progress.text.AcquireProgress(),
apt.progress.base.InstallProgress())
sys.stdout = orig_out
#apt_cache.close() #apt_cache.close()
return result return result
except SystemError as e: except SystemError as e:
@ -134,7 +143,12 @@ class EEAptGet():
if apt_cache.delete_count > 0: if apt_cache.delete_count > 0:
try: try:
# apt_pkg.PkgSystemUnLock() # apt_pkg.PkgSystemUnLock()
result = apt_cache.commit() orig_out = sys.stdout
sys.stdout = open(self.app.config.get('log.logging', 'file'),
'a')
result = apt_cache.commit(apt.progress.text.AcquireProgress(),
apt.progress.base.InstallProgress())
sys.stdout = orig_out
# apt_cache.close() # apt_cache.close()
return result return result
except SystemError as e: except SystemError as e:
@ -150,7 +164,10 @@ class EEAptGet():
Similar to `apt-get autoclean` Similar to `apt-get autoclean`
""" """
try: try:
orig_out = sys.stdout
sys.stdout = open(self.app.config.get('log.logging', 'file'), 'a')
apt_get.autoclean("-y") apt_get.autoclean("-y")
sys.stdout = orig_out
except ErrorReturnCode as e: except ErrorReturnCode as e:
Log.debug(self, "{0}".format(e)) Log.debug(self, "{0}".format(e))
Log.error(self, "Unable to apt-get autoclean") Log.error(self, "Unable to apt-get autoclean")

Loading…
Cancel
Save