本文整理汇总了Python中mcvirt.system.System.getUserInput方法的典型用法代码示例。如果您正苦于以下问题:Python System.getUserInput方法的具体用法?Python System.getUserInput怎么用?Python System.getUserInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mcvirt.system.System
的用法示例。
在下文中一共展示了System.getUserInput方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: authenticate_username_password
# 需要导入模块: from mcvirt.system import System [as 别名]
# 或者: from mcvirt.system.System import getUserInput [as 别名]
def authenticate_username_password(self, args, ignore_cluster):
"""Authenticate using username and password"""
# Check if user/password have been passed. Else, ask for them.
username = args.username if args.username else System.getUserInput(
'Username: '
).rstrip()
if args.password:
password = args.password
else:
password = System.getUserInput(
'Password: ', password=True
).rstrip()
self.rpc = Connection(username=username, password=password,
ignore_cluster=ignore_cluster)
self.session_id = self.rpc.session_id
self.username = self.rpc.username
示例2: handle_add
# 需要导入模块: from mcvirt.system import System [as 别名]
# 或者: from mcvirt.system.System import getUserInput [as 别名]
def handle_add(self, p_, args):
"""Handle add of node"""
cluster_object = p_.rpc.get_connection('cluster')
if args.connect_string:
connect_string = args.connect_string
else:
connect_string = System.getUserInput('Enter Connect String: ')
cluster_object.add_node(connect_string)
p_.print_status('Successfully added node')
示例3: check_ignore_failed
# 需要导入模块: from mcvirt.system import System [as 别名]
# 或者: from mcvirt.system.System import getUserInput [as 别名]
def check_ignore_failed(self, args):
"""Check ignore failed"""
if args.ignore_failed_nodes:
# If the user has specified to ignore the cluster,
# print a warning and confirm the user's answer
if not args.accept_failed_nodes_warning:
self.print_status(('WARNING: Running MCVirt with --ignore-failed-nodes'
' can leave the cluster in an inconsistent state!'))
continue_answer = System.getUserInput('Would you like to continue? (Y/n): ')
if continue_answer.strip() is not 'Y':
self.print_status('Cancelled...')
return
return True
return False