本文整理汇总了Python中tools.cli.prompt_for_password函数的典型用法代码示例。如果您正苦于以下问题:Python prompt_for_password函数的具体用法?Python prompt_for_password怎么用?Python prompt_for_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prompt_for_password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
示例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
示例3: 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
示例4: 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
示例5: 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)
示例6: 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())
示例7: 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)
示例8: 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)
示例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)
示例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)
示例11: get_args
def get_args():
"""Get command line args from the user.
"""
parser = cli.build_arg_parser()
parser.add_argument('-v', '--vm_name',
required=True,
action='store',
help='Virtual machine name')
parser.add_argument('-n', '--network_name',
required=True,
action='store',
help='Name of the portgroup or NSX-T Logical Switch')
args = parser.parse_args()
cli.prompt_for_password(args)
return args
示例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='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)
示例13: 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)
示例14: 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())
示例15: 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())