Implement refresh argument

Allows for re-provisioning of VM's.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-05-20 18:01:13 +02:00
parent 42235b9d62
commit ce0ad136aa
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -30,6 +30,7 @@ argparser.add_argument('--suite', help='Specify the suite to run', required=True
arggroup.add_argument('--stop', help='Stop running machines', action='store_true')
arggroup.add_argument('--test', help='Start machines and run tests', action='store_true')
arggroup.add_argument('--status', help='Get Vagrant deployment status', action='store_true')
arggroup.add_argument('--refresh', help='Re-sync files and re-run bootstrap scripts', action='store_true')
args = argparser.parse_args()
configfile = args.config
@ -134,7 +135,7 @@ def main_interactive():
log.info('Status report: {}'.format(v.status()))
return True
status = vagrant_isup(suite)
if status[0] is True and status[1] is None or args.stop:
if status[0] is True and status[1] is None or args.stop or args.refresh:
if args.stop is True:
log.info('Destroying machines ...')
v.destroy()
@ -142,8 +143,11 @@ def main_interactive():
log.debug('OK')
else:
_abort('Destruction failed')
else:
elif not args.refresh:
log.info('Deployment is already running')
elif args.refresh:
log.info('Deployment is running, initiating refresh ...')
v.provision()
elif status[0] is False:
if status[1] is True:
log.debug('Deployment is not running')