blob: 7fd72cdb73ad592068208208b288d6b03ca349d5 [file] [log] [blame]
Mike Frysingerf1ba7ad2022-09-12 05:42:57 -04001# Copyright 2016 The ChromiumOS Authors
Achuith Bhandarkard8d19292016-05-03 14:32:58 -07002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Achuith Bhandarkare3d5e572018-11-17 14:29:51 -08005"""CLI entry point into lib/vm.py; used for VM management."""
Achuith Bhandarkard8d19292016-05-03 14:32:58 -07006
Mike Frysinger2f5e8432022-04-15 21:53:36 -04007import logging
8
Achuith Bhandarkare3d5e572018-11-17 14:29:51 -08009from chromite.lib import vm
Achuith Bhandarkar9f49aca2018-10-30 17:46:07 -070010
Mike Frysinger4a243fb2020-02-21 02:56:35 -050011
Achuith Bhandarkard8d19292016-05-03 14:32:58 -070012def main(argv):
Alex Klein1699fab2022-09-08 08:46:06 -060013 opts = vm.VM.GetParser().parse_args(argv)
14 opts.Freeze()
Achuith Bhandarkar2beae292018-03-26 16:44:53 -070015
Alex Klein1699fab2022-09-08 08:46:06 -060016 try:
17 vm.VM(opts).Run()
18 return 0
19 except vm.VMError as e:
20 logging.error("%s", e)
21 if opts.debug:
22 raise
Mike Frysinger2f5e8432022-04-15 21:53:36 -040023
Alex Klein1699fab2022-09-08 08:46:06 -060024 logging.error("(Re-run with --debug for more details.)")
25 return 1