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,6 +68,8 @@ class AptUpgrade(Task):
|
|||
predecessors = [AptUpdate, DisableDaemonAutostart]
|
||||
|
||||
def run(self, info):
|
||||
from subprocess import CalledProcessError
|
||||
try:
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/apt-get', 'install',
|
||||
'--fix-broken',
|
||||
|
@ -77,6 +79,14 @@ class AptUpgrade(Task):
|
|||
'/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):
|
||||
|
|
|
@ -44,6 +44,12 @@ class InstallRemotePackages(Task):
|
|||
'this may be because\nthe image volume is '
|
||||
'running out of disk space ({free}MB left)').format(free=free_mb)
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue