mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-10-07 17:40:30 +00:00
Print some more helpful messages on apt failure
This commit is contained in:
parent
7afd04f1c9
commit
9a525628a2
2 changed files with 25 additions and 9 deletions
|
@ -68,15 +68,25 @@ class AptUpgrade(Task):
|
||||||
predecessors = [AptUpdate, DisableDaemonAutostart]
|
predecessors = [AptUpdate, DisableDaemonAutostart]
|
||||||
|
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
log_check_call(['/usr/sbin/chroot', info.root,
|
from subprocess import CalledProcessError
|
||||||
'/usr/bin/apt-get', 'install',
|
try:
|
||||||
'--fix-broken',
|
log_check_call(['/usr/sbin/chroot', info.root,
|
||||||
'--no-install-recommends',
|
'/usr/bin/apt-get', 'install',
|
||||||
'--assume-yes'])
|
'--fix-broken',
|
||||||
log_check_call(['/usr/sbin/chroot', info.root,
|
'--no-install-recommends',
|
||||||
'/usr/bin/apt-get', 'upgrade',
|
'--assume-yes'])
|
||||||
'--no-install-recommends',
|
log_check_call(['/usr/sbin/chroot', info.root,
|
||||||
'--assume-yes'])
|
'/usr/bin/apt-get', 'upgrade',
|
||||||
|
'--no-install-recommends',
|
||||||
|
'--assume-yes'])
|
||||||
|
except CalledProcessError as e:
|
||||||
|
if e.returncode == 100:
|
||||||
|
import logging
|
||||||
|
msg = ('apt exited with status code 100. '
|
||||||
|
'This can sometimes occur when package retrieval times out or a package extraction failed. '
|
||||||
|
'apt might succeed if you try bootstrapping again.')
|
||||||
|
logging.getLogger(__name__).warn(msg)
|
||||||
|
raise e
|
||||||
|
|
||||||
|
|
||||||
class PurgeUnusedPackages(Task):
|
class PurgeUnusedPackages(Task):
|
||||||
|
|
|
@ -44,6 +44,12 @@ class InstallRemotePackages(Task):
|
||||||
'this may be because\nthe image volume is '
|
'this may be because\nthe image volume is '
|
||||||
'running out of disk space ({free}MB left)').format(free=free_mb)
|
'running out of disk space ({free}MB left)').format(free=free_mb)
|
||||||
logging.getLogger(__name__).warn(msg)
|
logging.getLogger(__name__).warn(msg)
|
||||||
|
else:
|
||||||
|
if e.returncode == 100:
|
||||||
|
msg = ('apt exited with status code 100. '
|
||||||
|
'This can sometimes occur when package retrieval times out or a package extraction failed. '
|
||||||
|
'apt might succeed if you try bootstrapping again.')
|
||||||
|
logging.getLogger(__name__).warn(msg)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue