- if (len(sys.argv) < 4 or len(sys.argv) > 5
- or (len(sys.argv) == 5 and sys.argv[1] != '-nf')):
- log('Incorrect number of arguments')
- usage()
- sys.exit(1)
- without_fuel = False
- if len(sys.argv) == 5 and sys.argv[1] == '-nf':
- without_fuel = True
- iso_file = sys.argv[-3]
- dea_file = sys.argv[-2]
- dha_file = sys.argv[-1]
- check_file_exists(iso_file)
- check_file_exists(dea_file)
- check_file_exists(dha_file)
- return (without_fuel, iso_file, dea_file, dha_file)
+ parser = ArgParser(prog='python %s' % __file__)
+ parser.add_argument('-nf', dest='without_fuel', action='store_true',
+ default=False,
+ help='Do not install Fuel Master (and Node VMs when '
+ 'using libvirt)')
+ parser.add_argument('iso_file', nargs='?', action='store',
+ default='%s/OPNFV.iso' % CWD,
+ help='ISO File [default: OPNFV.iso]')
+ parser.add_argument('dea_file', action='store',
+ help='Deployment Environment Adapter: dea.yaml')
+ parser.add_argument('dha_file', action='store',
+ help='Deployment Hardware Adapter: dha.yaml')
+ parser.add_argument('storage_dir', nargs='?', action='store',
+ default='%s/images' % CWD,
+ help='Storage Directory [default: images]')
+ parser.add_argument('pxe_bridge', nargs='?', action='store',
+ default='pxebr',
+ help='Linux Bridge for booting up the Fuel Master VM '
+ '[default: pxebr]')
+
+ args = parser.parse_args()
+
+ check_file_exists(args.dea_file)
+ check_file_exists(args.dha_file)
+
+ if not args.without_fuel:
+ log('Using OPNFV ISO file: %s' % args.iso_file)
+ check_file_exists(args.iso_file)
+ log('Using image directory: %s' % args.storage_dir)
+ create_dir_if_not_exists(args.storage_dir)
+ log('Using bridge %s to boot up Fuel Master VM on it'
+ % args.pxe_bridge)
+ check_bridge(args.pxe_bridge, args.dha_file)
+
+ return (args.without_fuel, args.storage_dir, args.pxe_bridge,
+ args.iso_file, args.dea_file, args.dha_file)