mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-05 18:50:09 +02:00
makebuildserver added failsafe when destroy vagrant vm
This commit is contained in:
parent
70a827d59a
commit
7e8f7c65bc
@ -322,12 +322,15 @@ def sha256_for_file(path):
|
|||||||
def destroy_current_image(v, serverdir):
|
def destroy_current_image(v, serverdir):
|
||||||
global config
|
global config
|
||||||
|
|
||||||
logger.info('destroying buildserver vm, removing images and vagrand-configs...')
|
logger.info('destroying buildserver vm, removing images and vagrant-configs...')
|
||||||
|
|
||||||
# cannot run vagrant without the config in the YAML file
|
# cannot run vagrant without the config in the YAML file
|
||||||
if os.path.exists(os.path.join(serverdir, 'Vagrantfile.yaml')):
|
if os.path.exists(os.path.join(serverdir, 'Vagrantfile.yaml')):
|
||||||
v.destroy()
|
try:
|
||||||
logger.debug('vagrant destroy completed')
|
v.destroy()
|
||||||
|
logger.debug('vagrant destroy completed')
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
logger.debug('vagrant destroy failed: %s', e)
|
||||||
if logger.level <= logging.DEBUG:
|
if logger.level <= logging.DEBUG:
|
||||||
logger.debug('Cannot run destroy vagrant setup since Vagrantfile.yaml is not setup!')
|
logger.debug('Cannot run destroy vagrant setup since Vagrantfile.yaml is not setup!')
|
||||||
subprocess.check_call(['vagrant', 'global-status', '--prune'])
|
subprocess.check_call(['vagrant', 'global-status', '--prune'])
|
||||||
@ -573,11 +576,14 @@ def main():
|
|||||||
v.box_remove(config['basebox'], 'virtualbox')
|
v.box_remove(config['basebox'], 'virtualbox')
|
||||||
|
|
||||||
logger.info("Configuring build server VM")
|
logger.info("Configuring build server VM")
|
||||||
debug_log_vagrant_vm(serverdir, 'buildserver_default')
|
debug_log_vagrant_vm(serverdir, config['domain'])
|
||||||
try:
|
try:
|
||||||
v.up(provision=True)
|
try:
|
||||||
|
v.up(provision=True)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
v.up(provision=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug_log_vagrant_vm(serverdir, 'buildserver_default')
|
debug_log_vagrant_vm(serverdir, config['domain'])
|
||||||
logging.critical('could not bring buildserver vm up. %s', e)
|
logging.critical('could not bring buildserver vm up. %s', e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user