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

35
ee/core/aptget.py

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

Loading…
Cancel
Save