本文整理汇总了Python中tools.cli.build_arg_parser函数的典型用法代码示例。如果您正苦于以下问题:Python build_arg_parser函数的具体用法?Python build_arg_parser怎么用?Python build_arg_parser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build_arg_parser函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_args
def get_args():
"""
Adds additional args for deleting a snapshot of a fcd
-d datastore
-v vdisk
-n snapshot
-y yes
"""
parser = cli.build_arg_parser()
parser.add_argument('-d', '--datastore',
required=True,
action='store',
help='Datastore name where disk is located')
parser.add_argument('-v', '--vdisk',
required=False,
action='store',
help='First Class Disk name to delete snapshot for')
# because -s is reserved for 'service', we use -n for snapshot name
parser.add_argument('-n', '--snapshot',
required=True,
action='store',
help='Snapshot name to be deleted')
parser.add_argument('-y', '--yes',
action='store_true',
help='Confirm disk deletion.')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:vmware,项目名称:pyvmomi-community-samples,代码行数:33,代码来源:fcd_delete_vdisk_snapshot.py
示例2: get_args
def get_args():
"""Get command line args from the user.
"""
parser = cli.build_arg_parser()
parser.add_argument('-v', '--vm_uuid',
required=False,
action='store',
help='Virtual machine uuid')
parser.add_argument('-n', '--network_name',
required=False,
action='store',
help='Name of the network/portgroup')
parser.add_argument('-d', '--is_VDS',
action="store_true",
default=False,
help='The provided network is in VSS or VDS')
args = parser.parse_args()
cli.prompt_for_password(args)
return args
开发者ID:chrrrles,项目名称:pyvmomi-community-samples,代码行数:25,代码来源:change_vm_vif.py
示例3: get_args
def get_args():
"""Get command line args from the user.
"""
parser = cli.build_arg_parser()
parser.add_argument('-v', '--vm_uuid',
required=False,
action='store',
help='Virtual machine uuid')
parser.add_argument('-r', '--vm_user',
required=False,
action='store',
help='virtual machine user name')
parser.add_argument('-w', '--vm_pwd',
required=False,
action='store',
help='virtual machine password')
parser.add_argument('-l', '--path_inside_vm',
required=False,
action='store',
help='Path inside VM for upload')
parser.add_argument('-f', '--upload_file',
required=False,
action='store',
help='Path of the file to be uploaded from host')
args = parser.parse_args()
cli.prompt_for_password(args)
return args
开发者ID:nmadhok,项目名称:pyvmomi-community-samples,代码行数:35,代码来源:upload_file_to_vm.py
示例4: setup_args
def setup_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--property', default='runtime.powerState',
help='Name of the property to filter by')
parser.add_argument('-v', '--value', default='poweredOn',
help='Value to filter with')
return cli.prompt_for_password(parser.parse_args())
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:7,代码来源:filter_vms.py
示例5: get_args
def get_args():
"""
Adds additional args for detaching a disk from a vm
-n vm_name
-i uuid
-d disknumber
-l language
"""
parser = cli.build_arg_parser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-n', '--vm_name',
action='store',
help='Virtual Machine name where disk is attached')
group.add_argument('-i', '--uuid',
action='store',
help='Virtual Machine UUID where disk is attached')
parser.add_argument('-d', '--disknumber',
required=True,
help='HDD number to detach.',
type=int)
parser.add_argument('-l', '--language',
default='English',
help='Language your vcenter used.')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:vmware,项目名称:pyvmomi-community-samples,代码行数:31,代码来源:detach_disk_from_vm.py
示例6: get_args
def get_args():
"""
Adds additional args for deleting a fcd
-d datastore
-v vdisk
-y yes
"""
parser = cli.build_arg_parser()
parser.add_argument('-d', '--datastore',
required=True,
action='store',
help='Datastore name where disk is located')
parser.add_argument('-v', '--vdisk',
required=True,
action='store',
help='First Class Disk name to be deleted')
parser.add_argument('-y', '--yes',
action='store_true',
help='Confirm disk deletion.')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:vmware,项目名称:pyvmomi-community-samples,代码行数:26,代码来源:fcd_delete_vdisk.py
示例7: get_args
def get_args():
parser = cli.build_arg_parser()
parser.add_argument('-v', '--vm_name',
required=True,
action='store',
help='Name of the new VM')
parser.add_argument('--template_name',
required=True,
action='store',
help='Name of the template/VM you are cloning from')
parser.add_argument('--datacenter_name',
required=False,
action='store',
default=None,
help='Name of the Datacenter you wish to use.')
parser.add_argument('--cluster_name',
required=False,
action='store',
default=None,
help='Name of the cluster you wish to use')
parser.add_argument('--host_name',
required=False,
action='store',
default=None,
help='Name of the cluster you wish to use')
args = parser.parse_args()
cli.prompt_for_password(args)
return args
开发者ID:Deeksha117,项目名称:pyvmomi-community-samples,代码行数:34,代码来源:linked_clone.py
示例8: get_args
def get_args():
"""Get command line args from the user.
"""
parser = cli.build_arg_parser()
parser.add_argument('-v', '--vm_uuid',
required=True,
action='store',
help='Virtual machine uuid')
parser.add_argument('-r', '--vm_user',
required=True,
action='store',
help='virtual machine user name')
parser.add_argument('-w', '--vm_pwd',
required=False,
action='store',
help='virtual machine password')
parser.add_argument('-t', '--path_to_script',
required=True,
action='store',
help='Local path where the script is')
args = parser.parse_args()
cli.prompt_for_password(args)
return args
开发者ID:nucklehead,项目名称:pyvmomi-community-samples,代码行数:30,代码来源:execute_script_in_vm.py
示例9: setup_args
def setup_args():
"""
Get standard connection arguments
"""
parser = cli.build_arg_parser()
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:9,代码来源:get_vm_names.py
示例10: get_args
def get_args():
"""
Use the tools.cli methods and then add a few more arguments.
"""
parser = cli.build_arg_parser()
parser.add_argument('-c', '--count',
type=int,
required=True,
action='store',
help='Number of VMs to create')
parser.add_argument('-d', '--datastore',
required=True,
action='store',
help='Name of Datastore to create VM in')
parser.add_argument('--datacenter',
required=True,
help='Name of the datacenter to create VM in.')
parser.add_argument('--folder',
required=True,
help='Name of the vm folder to create VM in.')
parser.add_argument('--resource-pool',
required=True,
help='Name of resource pool to create VM in.')
parser.add_argument('--opaque-network',
help='Name of the opaque network to add to the new VM')
# NOTE (hartsock): as a matter of good security practice, never ever
# save a credential of any kind in the source code of a file. As a
# matter of policy we want to show people good programming practice in
# these samples so that we don't encourage security audit problems for
# people in the future.
parser.add_argument('-k', '--public_key_file',
required=False,
action='store',
help='Name of the file holding your marvel public key,'
' the key should be the first only of the file. '
'Set one up at developer.marvel.com/account')
parser.add_argument('-e', '--private_key_file',
required=False,
action='store',
help='Name of the file holding your marvel private '
'key, the key should be the only line of the '
'file. '
'Set one up at developer.marvel.com/account')
args = parser.parse_args()
return cli.prompt_for_password(args)
开发者ID:tianhao64,项目名称:pyvmomi-community-samples,代码行数:56,代码来源:create_random_marvel_vms.py
示例11: get_args
def get_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--vmname', required=True,
help="Name of the VirtualMachine you want to change.")
parser.add_argument('-m', '--unitnumber', required=True,
help='HDD number to delete.', type=int)
parser.add_argument('-y', '--yes',
help='Confirm disk deletion.', action='store_true')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:Deeksha117,项目名称:pyvmomi-community-samples,代码行数:10,代码来源:delete_disk_from_vm.py
示例12: get_args
def get_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--vmname', required=True,
help="Name of the VirtualMachine you want to change.")
parser.add_argument('-m', '--unitnumber', required=True,
help='NIC number.', type=int)
parser.add_argument('-t', '--state', required=True,
choices=['delete', 'disconnect', 'connect'])
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:10,代码来源:change_vm_nic_state.py
示例13: setup_args
def setup_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--name',
help='Name of the VM to test CD-rom on')
parser.add_argument('-i', '--iso',
help='ISO to use in test. Use datastore path format. '
'E.g. [datastore1] path/to/file.iso')
parser.add_argument('-d', '--datacenter',
help='Name of datacenter to search on. '
'Defaults to first.')
return cli.prompt_for_password(parser.parse_args())
开发者ID:Jayraj123,项目名称:pyvmomi-community-samples,代码行数:11,代码来源:cdrom_vm.py
示例14: setup_args
def setup_args():
"""
Adds additional args to allow the vm uuid to
be set.
"""
parser = cli.build_arg_parser()
# using j here because -u is used for user
parser.add_argument('-j', '--uuid',
required=True,
help='UUID of the VirtualMachine you want to reboot.')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:kyanite,项目名称:pyvmomi-community-samples,代码行数:12,代码来源:soft_reboot.py
示例15: get_args
def get_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--vmname', required=True,
help="Name of the VirtualMachine you want to change.")
parser.add_argument('-m', '--unitnumber', required=True,
help='CD/DVD unit number.', type=int)
parser.add_argument('-i', '--iso', required=False,
help='Full path to iso. i.e. "[ds1] folder/Ubuntu.iso"'
' If not provided, backend will'
' set to RemotePassThrough')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:Deeksha117,项目名称:pyvmomi-community-samples,代码行数:12,代码来源:change_vm_cd_backend.py
示例16: setup_args
def setup_args():
parser = cli.build_arg_parser()
parser.add_argument('-n', '--name',
help='Name of the VM for relocate events')
parser.add_argument('-d', '--datacenter',
help='Name of datacenter to search on. '
'Defaults to first.')
parser.add_argument('--filterUsers',
help="Comma-separated list of users to filter on")
parser.add_argument('--filterSystemUser', action='store_true',
help="Filter system user, defaults to false.")
return cli.prompt_for_password(parser.parse_args())
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:12,代码来源:relocate_events.py
示例17: get_args
def get_args():
"""
Add VM name to args
"""
parser = cli.build_arg_parser()
parser.add_argument('-n', '--name',
required=True,
help='Name of Virtual Machine.')
args = parser.parse_args()
return cli.prompt_for_password(args)
开发者ID:Deeksha117,项目名称:pyvmomi-community-samples,代码行数:13,代码来源:generate_html5_console.py
示例18: setup_args
def setup_args():
parser = cli.build_arg_parser()
parser.add_argument('-j', '--uuid', required=True,
help="UUID of the VirtualMachine you want to find."
" If -i is not used BIOS UUID assumed.")
parser.add_argument('-i', '--instance', required=False,
action='store_true',
help="Flag to indicate the UUID is an instance UUID")
parser.add_argument('-d', '--description', required=False,
help="Description for the snapshot")
parser.add_argument('-n', '--name', required=True,
help="Name for the Snapshot")
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:14,代码来源:create_snapshot.py
示例19: setup_args
def setup_args():
parser = cli.build_arg_parser()
# parser.add_argument('-j', '--uuid', required=False,
# help="UUID of the VirtualMachine you want to find."
# " If -i is not used BIOS UUID assumed.")
# parser.add_argument('-i', '--instance', required=False,
# action='store_true',
# help="Flag to indicate the UUID is an instance UUID")
parser.add_argument('-n', '--name',
required=False,
action='store',
help="name of VirtualMachine")
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:frohoff,项目名称:pyvmomi-community-samples,代码行数:14,代码来源:restore_snapshot.py
示例20: setup_args
def setup_args():
"""
Adds additional ARG to allow the uuid to be set.
"""
parser = cli.build_arg_parser()
# using j here because -u is used for user
parser.add_argument('-j', '--uuid',
help='UUID of the HostSystem you want to find'
' duplicate of if not looking for the default'
' Dell UUID: 44454C4C-0000-1020-8020-80C04F202020')
my_args = parser.parse_args()
return cli.prompt_for_password(my_args)
开发者ID:virtdevninja,项目名称:pyvmomi-community-samples,代码行数:14,代码来源:find_dell_default_uuid.py
注:本文中的tools.cli.build_arg_parser函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论