• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cli.prompt_for_password函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tools.cli.prompt_for_password函数的典型用法代码示例。如果您正苦于以下问题:Python prompt_for_password函数的具体用法?Python prompt_for_password怎么用?Python prompt_for_password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了prompt_for_password函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:nmadhok,项目名称:pyvmomi-community-samples,代码行数:35,代码来源:upload_file_to_vm.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():
    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


示例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
开发者ID:nucklehead,项目名称:pyvmomi-community-samples,代码行数:30,代码来源:execute_script_in_vm.py


示例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)
开发者ID:vmware,项目名称:pyvmomi-community-samples,代码行数:33,代码来源:fcd_delete_vdisk_snapshot.py


示例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())
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:7,代码来源:filter_vms.py


示例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)
开发者ID:vmware,项目名称:pyvmomi-community-samples,代码行数:31,代码来源:detach_disk_from_vm.py


示例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)
开发者ID:vmware,项目名称:pyvmomi-community-samples,代码行数:26,代码来源:fcd_delete_vdisk.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():
    """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
开发者ID:tianhao64,项目名称:pyvmomi-community-samples,代码行数:19,代码来源:nsxt_change_vm_vif.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='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


示例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)
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:10,代码来源:change_vm_nic_state.py


示例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())
开发者ID:Jayraj123,项目名称:pyvmomi-community-samples,代码行数:11,代码来源:cdrom_vm.py


示例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())
开发者ID:almightyyeh,项目名称:pyvmomi-community-samples,代码行数:12,代码来源:relocate_events.py


示例16: 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


示例17: 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


示例18: main

def main():
    """
    Simple command-line program for listing all ESXi datastores and their
    associated devices
    """

    args = get_args()

    cli.prompt_for_password(args)

    try:
        service_instance = connect.SmartConnect(host=args.host,
                                                user=args.user,
                                                pwd=args.password,
                                                port=int(args.port))
        if not service_instance:
            print("Could not connect to the specified host using specified "
                  "username and password")
            return -1

        atexit.register(connect.Disconnect, service_instance)

        content = service_instance.RetrieveContent()
        # Search for all ESXi hosts
        objview = content.viewManager.CreateContainerView(content.rootFolder,
                                                          [vim.VirtualMachine],
                                                          True)
        vms = objview.view
        objview.Destroy()

        for vm in vms:
            if vm.name == args.vm_name:
                print "VM {} is {}".format(vm.name, vm.runtime.powerState)
                break

    except vmodl.MethodFault as error:
        print "Caught vmodl fault : " + error.msg
        return -1

    return 0
开发者ID:duffolonious,项目名称:pyvmomi-community-samples,代码行数:40,代码来源:get_vm_power_state.py


示例19: 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:derchrisuk,项目名称:pyvmomi-community-samples,代码行数:22,代码来源:upload_file_to_vm.py


示例20: 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



注:本文中的tools.cli.prompt_for_password函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python clog.info函数代码示例发布时间:2022-05-27
下一篇:
Python cli.build_arg_parser函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap