2016-10-26 19:08:23 -04:00
|
|
|
"""
|
|
|
|
* *******************************************************
|
|
|
|
* Copyright (c) VMware, Inc. 2016. All Rights Reserved.
|
2017-03-15 18:36:13 -04:00
|
|
|
* SPDX-License-Identifier: MIT
|
2016-10-26 19:08:23 -04:00
|
|
|
* *******************************************************
|
|
|
|
*
|
|
|
|
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN,
|
|
|
|
* EXPRESS OR IMPLIED. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED
|
|
|
|
* WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY,
|
|
|
|
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = 'VMware, Inc.'
|
|
|
|
__copyright__ = 'Copyright 2016 VMware, Inc. All rights reserved.'
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
|
|
def build_arg_parser():
|
|
|
|
"""
|
|
|
|
Builds a standard argument parser with arguments for talking to vCenter
|
|
|
|
|
|
|
|
-s server
|
|
|
|
-u username
|
|
|
|
-p password
|
|
|
|
-c cleanup
|
2017-08-18 02:09:38 -04:00
|
|
|
-v skipverification
|
2016-10-26 19:08:23 -04:00
|
|
|
|
|
|
|
"""
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description='Standard Arguments for talking to vCenter')
|
|
|
|
|
2019-08-20 02:54:24 -04:00
|
|
|
required_args = parser.add_argument_group(
|
|
|
|
'required arguments')
|
|
|
|
required_args.add_argument('-s', '--server',
|
2016-10-26 19:08:23 -04:00
|
|
|
action='store',
|
2019-08-20 02:54:24 -04:00
|
|
|
required=True,
|
2016-10-26 19:08:23 -04:00
|
|
|
help='vSphere service IP to connect to')
|
|
|
|
|
2019-08-20 02:54:24 -04:00
|
|
|
required_args.add_argument('-u', '--username',
|
2016-10-26 19:08:23 -04:00
|
|
|
action='store',
|
2019-08-20 02:54:24 -04:00
|
|
|
required=True,
|
2016-10-26 19:08:23 -04:00
|
|
|
help='Username to use when connecting to vc')
|
|
|
|
|
2019-08-20 02:54:24 -04:00
|
|
|
required_args.add_argument('-p', '--password',
|
2016-10-26 19:08:23 -04:00
|
|
|
action='store',
|
2019-08-20 02:54:24 -04:00
|
|
|
required=True,
|
2016-10-26 19:08:23 -04:00
|
|
|
help='Password to use when connecting to vc')
|
|
|
|
|
2017-08-18 02:09:38 -04:00
|
|
|
parser.add_argument('-c', '--cleardata',
|
2016-10-26 19:08:23 -04:00
|
|
|
action='store_true',
|
|
|
|
help='Clean up after sample run. ')
|
|
|
|
|
|
|
|
parser.add_argument('-v', '--skipverification',
|
|
|
|
action='store_true',
|
|
|
|
help='Verify server certificate when connecting to vc.')
|
|
|
|
|
|
|
|
return parser
|