diff --git a/scullery.py b/scullery.py index bbbbfb5..c430064 100755 --- a/scullery.py +++ b/scullery.py @@ -31,6 +31,7 @@ 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') +argparser.add_argument('--force-stop', help='Invoke Vagrant destruction without having detected any running VM\'s', action='store_true') args = argparser.parse_args() configfile = args.config @@ -150,8 +151,8 @@ 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 or args.refresh: - if args.stop is True: + if status[0] is True and status[1] is None or args.force_stop or args.refresh: + if True in [args.stop, args.force_stop]: log.info('Destroying machines ...') v.destroy() if vagrant_isup(suite)[0] is False: @@ -174,7 +175,7 @@ def main_interactive(): log.exception(myerror) _abort('Unhandled error') - if args.stop is False: + if args.stop is False and args.force_stop is False: log.info('Launching {} ...'.format(suite)) v.up() if vagrant_isup(suite)[0] is True: