1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

makebuildserver more robust codepath for vagrant destroy

This commit is contained in:
Michael Pöhn 2017-03-25 02:48:00 +01:00 committed by Hans-Christoph Steiner
parent 7e8f7c65bc
commit 3c4b1dec84

View File

@ -324,16 +324,15 @@ def destroy_current_image(v, serverdir):
logger.info('destroying buildserver vm, removing images and vagrant-configs...')
# cannot run vagrant without the config in the YAML file
if os.path.exists(os.path.join(serverdir, 'Vagrantfile.yaml')):
try:
v.destroy()
logger.debug('vagrant destroy completed')
except subprocess.CalledProcessError as e:
logger.debug('vagrant destroy failed: %s', e)
if logger.level <= logging.DEBUG:
logger.debug('Cannot run destroy vagrant setup since Vagrantfile.yaml is not setup!')
try:
subprocess.check_call(['vagrant', 'global-status', '--prune'])
except subprocess.CalledProcessError as e:
logger.debug('pruning global vagrant status failed: %s', e)
try:
shutil.rmtree(os.path.join(serverdir, '.vagrant'))