Python 3 compatibility: convert raw_input to input
Story: 2003433 Task: 26063 Change-Id: Ia3739a55f36e614d6fe626fcd2917a9d6f6b2765 Signed-off-by: zhangyangyang <zhangyangyang@unionpay.com>
This commit is contained in:
parent
3a29c1170d
commit
fd9a8a0714
|
@ -33,6 +33,7 @@ import openstack
|
||||||
import tsconfig.tsconfig as tsconfig
|
import tsconfig.tsconfig as tsconfig
|
||||||
import utils
|
import utils
|
||||||
import sysinv_api as sysinv
|
import sysinv_api as sysinv
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
LOG = log.get_logger(__name__)
|
LOG = log.get_logger(__name__)
|
||||||
|
@ -1348,7 +1349,7 @@ def restore_system(backup_file, clone=False):
|
||||||
print ("After the reboot is complete, " +
|
print ("After the reboot is complete, " +
|
||||||
"re-execute the restore command.")
|
"re-execute the restore command.")
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Enter 'reboot' to reboot controller: ")
|
"Enter 'reboot' to reboot controller: ")
|
||||||
if user_input == 'reboot':
|
if user_input == 'reboot':
|
||||||
break
|
break
|
||||||
|
|
|
@ -14,6 +14,7 @@ import time
|
||||||
|
|
||||||
import configutilities.common.exceptions as cexeptions
|
import configutilities.common.exceptions as cexeptions
|
||||||
import configutilities.common.utils as cutils
|
import configutilities.common.utils as cutils
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
def is_valid_management_address(ip_address, management_subnet):
|
def is_valid_management_address(ip_address, management_subnet):
|
||||||
|
@ -80,7 +81,7 @@ def configure_management():
|
||||||
|
|
||||||
print
|
print
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Enter management interface name: ")
|
user_input = input("Enter management interface name: ")
|
||||||
if user_input in interface_list:
|
if user_input in interface_list:
|
||||||
management_interface = user_input
|
management_interface = user_input
|
||||||
break
|
break
|
||||||
|
@ -89,8 +90,8 @@ def configure_management():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Enter management IP address in CIDR "
|
user_input = input("Enter management IP address in CIDR "
|
||||||
"notation, ie. ip/prefix_length: ")
|
"notation, ie. ip/prefix_length: ")
|
||||||
try:
|
try:
|
||||||
management_cidr = netaddr.IPNetwork(user_input)
|
management_cidr = netaddr.IPNetwork(user_input)
|
||||||
management_ip = management_cidr.ip
|
management_ip = management_cidr.ip
|
||||||
|
@ -107,8 +108,8 @@ def configure_management():
|
||||||
"CIDR notation.")
|
"CIDR notation.")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Enter management gateway IP address [" +
|
user_input = input("Enter management gateway IP address [" +
|
||||||
str(management_network[1]) + "]: ")
|
str(management_network[1]) + "]: ")
|
||||||
if user_input == "":
|
if user_input == "":
|
||||||
user_input = management_network[1]
|
user_input = management_network[1]
|
||||||
|
|
||||||
|
@ -125,8 +126,8 @@ def configure_management():
|
||||||
|
|
||||||
min_addresses = 8
|
min_addresses = 8
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Enter System Controller subnet in "
|
user_input = input("Enter System Controller subnet in "
|
||||||
"CIDR notation: ")
|
"CIDR notation: ")
|
||||||
try:
|
try:
|
||||||
system_controller_subnet = cutils.validate_network_str(
|
system_controller_subnet = cutils.validate_network_str(
|
||||||
user_input, min_addresses)
|
user_input, min_addresses)
|
||||||
|
|
|
@ -41,6 +41,7 @@ from common import constants
|
||||||
from common import log
|
from common import log
|
||||||
from common.exceptions import KeystoneFail, SysInvFail
|
from common.exceptions import KeystoneFail, SysInvFail
|
||||||
from common.exceptions import UserQuit
|
from common.exceptions import UserQuit
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
LOG = log.get_logger(__name__)
|
LOG = log.get_logger(__name__)
|
||||||
|
|
||||||
|
@ -59,7 +60,7 @@ def timestamped(dname, fmt='{dname}_%Y-%m-%d-%H-%M-%S'):
|
||||||
def prompt_for(prompt_text, default_input, validator):
|
def prompt_for(prompt_text, default_input, validator):
|
||||||
valid = False
|
valid = False
|
||||||
while not valid:
|
while not valid:
|
||||||
user_input = raw_input(prompt_text)
|
user_input = input(prompt_text)
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -545,7 +546,7 @@ class ConfigAssistant():
|
||||||
now.strftime(date_format))
|
now.strftime(date_format))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"\nIs the current date and time correct? [y/n]: ")
|
"\nIs the current date and time correct? [y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -559,8 +560,8 @@ class ConfigAssistant():
|
||||||
|
|
||||||
new_time = None
|
new_time = None
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("\nEnter new system date and time (UTC) " +
|
user_input = input("\nEnter new system date and time (UTC) " +
|
||||||
"in YYYY-MM-DD HH:MM:SS format: \n")
|
"in YYYY-MM-DD HH:MM:SS format: \n")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
else:
|
else:
|
||||||
|
@ -600,7 +601,7 @@ class ConfigAssistant():
|
||||||
print
|
print
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Please input the timezone[" + self.timezone + "]:")
|
"Please input the timezone[" + self.timezone + "]:")
|
||||||
|
|
||||||
if user_input == 'Q' or user_input == 'q':
|
if user_input == 'Q' or user_input == 'q':
|
||||||
|
@ -797,7 +798,7 @@ class ConfigAssistant():
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print
|
print
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Configure a separate PXEBoot network [y/N]: ")
|
"Configure a separate PXEBoot network [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -815,8 +816,8 @@ class ConfigAssistant():
|
||||||
|
|
||||||
if self.separate_pxeboot_network:
|
if self.separate_pxeboot_network:
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("PXEBoot subnet [" +
|
user_input = input("PXEBoot subnet [" +
|
||||||
str(self.pxeboot_subnet) + "]: ")
|
str(self.pxeboot_subnet) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -891,7 +892,7 @@ class ConfigAssistant():
|
||||||
"interface link aggregation, for All-in-one duplex-direct."
|
"interface link aggregation, for All-in-one duplex-direct."
|
||||||
)
|
)
|
||||||
print
|
print
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Management interface link aggregation [y/N]: ")
|
"Management interface link aggregation [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -911,8 +912,8 @@ class ConfigAssistant():
|
||||||
if self.lag_management_interface:
|
if self.lag_management_interface:
|
||||||
self.management_interface = self.get_next_lag_name()
|
self.management_interface = self.get_next_lag_name()
|
||||||
|
|
||||||
user_input = raw_input("Management interface [" +
|
user_input = input("Management interface [" +
|
||||||
str(self.management_interface) + "]: ")
|
str(self.management_interface) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -943,8 +944,8 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Management interface MTU [" +
|
user_input = input("Management interface MTU [" +
|
||||||
str(self.management_mtu) + "]: ")
|
str(self.management_mtu) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -958,7 +959,7 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Management interface link capacity Mbps [" +
|
"Management interface link capacity Mbps [" +
|
||||||
str(self.management_link_capacity) + "]: ")
|
str(self.management_link_capacity) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -983,7 +984,7 @@ class ConfigAssistant():
|
||||||
print " 1) 802.3ad (LACP) policy"
|
print " 1) 802.3ad (LACP) policy"
|
||||||
print " 2) Active-backup policy"
|
print " 2) Active-backup policy"
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"\nManagement interface bonding policy [" +
|
"\nManagement interface bonding policy [" +
|
||||||
str(self.lag_management_interface_policy) + "]: ")
|
str(self.lag_management_interface_policy) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1012,7 +1013,7 @@ class ConfigAssistant():
|
||||||
"management interface.", 80)
|
"management interface.", 80)
|
||||||
print
|
print
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"First management interface member [" +
|
"First management interface member [" +
|
||||||
str(self.lag_management_interface_member0) + "]: ")
|
str(self.lag_management_interface_member0) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1035,7 +1036,7 @@ class ConfigAssistant():
|
||||||
self.lag_management_interface_member0 = ""
|
self.lag_management_interface_member0 = ""
|
||||||
continue
|
continue
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Second management interface member [" +
|
"Second management interface member [" +
|
||||||
str(self.lag_management_interface_member1) + "]: ")
|
str(self.lag_management_interface_member1) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1060,7 +1061,7 @@ class ConfigAssistant():
|
||||||
else:
|
else:
|
||||||
print "Interface does not exist"
|
print "Interface does not exist"
|
||||||
self.lag_management_interface_member1 = ""
|
self.lag_management_interface_member1 = ""
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Do you want a single physical member in the bond "
|
"Do you want a single physical member in the bond "
|
||||||
"interface [y/n]: ")
|
"interface [y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1078,7 +1079,7 @@ class ConfigAssistant():
|
||||||
print
|
print
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Management VLAN Identifier [" +
|
"Management VLAN Identifier [" +
|
||||||
str(self.management_vlan) + "]: ")
|
str(self.management_vlan) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1094,8 +1095,8 @@ class ConfigAssistant():
|
||||||
|
|
||||||
min_addresses = 8
|
min_addresses = 8
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Management subnet [" +
|
user_input = input("Management subnet [" +
|
||||||
str(self.management_subnet) + "]: ")
|
str(self.management_subnet) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -1135,7 +1136,7 @@ class ConfigAssistant():
|
||||||
if (self.system_dc_role !=
|
if (self.system_dc_role !=
|
||||||
sysinv_constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER):
|
sysinv_constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER):
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Use entire management subnet [Y/n]: ")
|
"Use entire management subnet [Y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -1163,7 +1164,7 @@ class ConfigAssistant():
|
||||||
self.management_start_address = self.management_subnet[2]
|
self.management_start_address = self.management_subnet[2]
|
||||||
self.management_end_address = self.management_subnet[-2]
|
self.management_end_address = self.management_subnet[-2]
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Management network start address [" +
|
"Management network start address [" +
|
||||||
str(self.management_start_address) + "]: ")
|
str(self.management_start_address) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1179,7 +1180,7 @@ class ConfigAssistant():
|
||||||
print ("Invalid start address. \n Reason: %s" % e)
|
print ("Invalid start address. \n Reason: %s" % e)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Management network end address [" +
|
"Management network end address [" +
|
||||||
str(self.management_end_address) + "]: ")
|
str(self.management_end_address) + "]: ")
|
||||||
if user_input == 'Q' or user_input == 'q':
|
if user_input == 'Q' or user_input == 'q':
|
||||||
|
@ -1233,7 +1234,7 @@ class ConfigAssistant():
|
||||||
"disables automatic provisioning of new hosts in System "
|
"disables automatic provisioning of new hosts in System "
|
||||||
"Inventory, requiring the user to manually provision using "
|
"Inventory, requiring the user to manually provision using "
|
||||||
"the 'system host-add' command. ", 80)
|
"the 'system host-add' command. ", 80)
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Dynamic IP address allocation [Y/n]: ")
|
"Dynamic IP address allocation [Y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -1299,9 +1300,9 @@ class ConfigAssistant():
|
||||||
self.management_multicast_subnet = \
|
self.management_multicast_subnet = \
|
||||||
IPNetwork(constants.DEFAULT_MULTICAST_SUBNET_IPV6)
|
IPNetwork(constants.DEFAULT_MULTICAST_SUBNET_IPV6)
|
||||||
|
|
||||||
user_input = raw_input("Management Network Multicast subnet [" +
|
user_input = input("Management Network Multicast subnet [" +
|
||||||
str(self.management_multicast_subnet) +
|
str(self.management_multicast_subnet) +
|
||||||
"]: ")
|
"]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -1388,7 +1389,7 @@ class ConfigAssistant():
|
||||||
infra_vlan_required = False
|
infra_vlan_required = False
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Configure an infrastructure interface [y/N]: ")
|
"Configure an infrastructure interface [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -1407,7 +1408,7 @@ class ConfigAssistant():
|
||||||
"An infrastructure bond interface provides redundant "
|
"An infrastructure bond interface provides redundant "
|
||||||
"connections for the infrastructure network.", 80)
|
"connections for the infrastructure network.", 80)
|
||||||
print
|
print
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Infrastructure interface link aggregation [y/N]: ")
|
"Infrastructure interface link aggregation [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -1425,8 +1426,8 @@ class ConfigAssistant():
|
||||||
if self.lag_infrastructure_interface:
|
if self.lag_infrastructure_interface:
|
||||||
self.infrastructure_interface = self.get_next_lag_name()
|
self.infrastructure_interface = self.get_next_lag_name()
|
||||||
|
|
||||||
user_input = raw_input("Infrastructure interface [" +
|
user_input = input("Infrastructure interface [" +
|
||||||
str(self.infrastructure_interface) + "]: ")
|
str(self.infrastructure_interface) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == '':
|
elif user_input == '':
|
||||||
|
@ -1466,13 +1467,13 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Configure an infrastructure VLAN [y/N]: ")
|
"Configure an infrastructure VLAN [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input.lower() == 'y':
|
elif user_input.lower() == 'y':
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Infrastructure VLAN Identifier [" +
|
"Infrastructure VLAN Identifier [" +
|
||||||
str(self.infrastructure_vlan) + "]: ")
|
str(self.infrastructure_vlan) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1508,8 +1509,8 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Infrastructure interface MTU [" +
|
user_input = input("Infrastructure interface MTU [" +
|
||||||
str(self.infrastructure_mtu) + "]: ")
|
str(self.infrastructure_mtu) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -1531,7 +1532,7 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Infrastructure interface link capacity Mbps [" +
|
"Infrastructure interface link capacity Mbps [" +
|
||||||
str(self.infrastructure_link_capacity) + "]: ")
|
str(self.infrastructure_link_capacity) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1556,7 +1557,7 @@ class ConfigAssistant():
|
||||||
print " 2) Balanced XOR policy"
|
print " 2) Balanced XOR policy"
|
||||||
print " 3) 802.3ad (LACP) policy"
|
print " 3) 802.3ad (LACP) policy"
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"\nInfrastructure interface bonding policy [" +
|
"\nInfrastructure interface bonding policy [" +
|
||||||
str(self.lag_infrastructure_interface_policy) + "]: ")
|
str(self.lag_infrastructure_interface_policy) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1593,7 +1594,7 @@ class ConfigAssistant():
|
||||||
"infrastructure interface.", 80)
|
"infrastructure interface.", 80)
|
||||||
print
|
print
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"First infrastructure interface member [" +
|
"First infrastructure interface member [" +
|
||||||
str(self.lag_infrastructure_interface_member0) + "]: ")
|
str(self.lag_infrastructure_interface_member0) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1616,7 +1617,7 @@ class ConfigAssistant():
|
||||||
self.lag_infrastructure_interface_member0 = ""
|
self.lag_infrastructure_interface_member0 = ""
|
||||||
continue
|
continue
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Second infrastructure interface member [" +
|
"Second infrastructure interface member [" +
|
||||||
str(self.lag_infrastructure_interface_member1) + "]: ")
|
str(self.lag_infrastructure_interface_member1) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1642,7 +1643,7 @@ class ConfigAssistant():
|
||||||
else:
|
else:
|
||||||
print "Interface does not exist"
|
print "Interface does not exist"
|
||||||
self.lag_infrastructure_interface_member1 = ""
|
self.lag_infrastructure_interface_member1 = ""
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Do you want a single physical member in the bond "
|
"Do you want a single physical member in the bond "
|
||||||
"interface [y/n]: ")
|
"interface [y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1657,8 +1658,8 @@ class ConfigAssistant():
|
||||||
|
|
||||||
min_addresses = 8
|
min_addresses = 8
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("Infrastructure subnet [" +
|
user_input = input("Infrastructure subnet [" +
|
||||||
str(self.infrastructure_subnet) + "]: ")
|
str(self.infrastructure_subnet) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -1700,7 +1701,7 @@ class ConfigAssistant():
|
||||||
self.infrastructure_end_address = \
|
self.infrastructure_end_address = \
|
||||||
self.infrastructure_subnet[-2]
|
self.infrastructure_subnet[-2]
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Use entire infrastructure subnet [Y/n]: ")
|
"Use entire infrastructure subnet [Y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -1719,7 +1720,7 @@ class ConfigAssistant():
|
||||||
if not self.use_entire_infra_subnet:
|
if not self.use_entire_infra_subnet:
|
||||||
while True:
|
while True:
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Infrastructure network start address [" +
|
"Infrastructure network start address [" +
|
||||||
str(self.infrastructure_start_address) + "]: ")
|
str(self.infrastructure_start_address) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1736,7 +1737,7 @@ class ConfigAssistant():
|
||||||
print ("Invalid start address. \n Reason: %s" % e)
|
print ("Invalid start address. \n Reason: %s" % e)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Infrastructure network end address [" +
|
"Infrastructure network end address [" +
|
||||||
str(self.infrastructure_end_address) + "]: ")
|
str(self.infrastructure_end_address) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1842,7 +1843,7 @@ class ConfigAssistant():
|
||||||
def input_aio_simplex_oam_ip_address(self):
|
def input_aio_simplex_oam_ip_address(self):
|
||||||
"""Allow user to input external OAM IP and perform validation."""
|
"""Allow user to input external OAM IP and perform validation."""
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"External OAM address [" +
|
"External OAM address [" +
|
||||||
str(self.external_oam_gateway_address + 1) + "]: ")
|
str(self.external_oam_gateway_address + 1) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1867,7 +1868,7 @@ class ConfigAssistant():
|
||||||
def input_oam_ip_address(self):
|
def input_oam_ip_address(self):
|
||||||
"""Allow user to input external OAM IP and perform validation."""
|
"""Allow user to input external OAM IP and perform validation."""
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"External OAM floating address [" +
|
"External OAM floating address [" +
|
||||||
str(self.external_oam_gateway_address + 1) + "]: ")
|
str(self.external_oam_gateway_address + 1) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -1888,10 +1889,10 @@ class ConfigAssistant():
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("External OAM address for first "
|
user_input = input("External OAM address for first "
|
||||||
"controller node [" +
|
"controller node [" +
|
||||||
str(self.external_oam_floating_address + 1)
|
str(self.external_oam_floating_address + 1)
|
||||||
+ "]: ")
|
+ "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -1910,10 +1911,10 @@ class ConfigAssistant():
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("External OAM address for second "
|
user_input = input("External OAM address for second "
|
||||||
"controller node [" +
|
"controller node [" +
|
||||||
str(self.external_oam_address_0 + 1) +
|
str(self.external_oam_address_0 + 1) +
|
||||||
"]: ")
|
"]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -1950,7 +1951,7 @@ class ConfigAssistant():
|
||||||
"An external OAM bond interface provides redundant "
|
"An external OAM bond interface provides redundant "
|
||||||
"connections for the OAM network.", 80)
|
"connections for the OAM network.", 80)
|
||||||
print
|
print
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"External OAM interface link aggregation [y/N]: ")
|
"External OAM interface link aggregation [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
@ -1970,8 +1971,8 @@ class ConfigAssistant():
|
||||||
if self.lag_external_oam_interface:
|
if self.lag_external_oam_interface:
|
||||||
self.external_oam_interface = self.get_next_lag_name()
|
self.external_oam_interface = self.get_next_lag_name()
|
||||||
|
|
||||||
user_input = raw_input("External OAM interface [" +
|
user_input = input("External OAM interface [" +
|
||||||
str(self.external_oam_interface) + "]: ")
|
str(self.external_oam_interface) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -2010,13 +2011,13 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Configure an external OAM VLAN [y/N]: ")
|
"Configure an external OAM VLAN [y/N]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input.lower() == 'y':
|
elif user_input.lower() == 'y':
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"External OAM VLAN Identifier [" +
|
"External OAM VLAN Identifier [" +
|
||||||
str(self.external_oam_vlan) + "]: ")
|
str(self.external_oam_vlan) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -2053,8 +2054,8 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("External OAM interface MTU [" +
|
user_input = input("External OAM interface MTU [" +
|
||||||
str(self.external_oam_mtu) + "]: ")
|
str(self.external_oam_mtu) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -2102,7 +2103,7 @@ class ConfigAssistant():
|
||||||
print " 2) Balanced XOR policy"
|
print " 2) Balanced XOR policy"
|
||||||
print " 3) 802.3ad (LACP) policy"
|
print " 3) 802.3ad (LACP) policy"
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"\nExternal OAM interface bonding policy [" +
|
"\nExternal OAM interface bonding policy [" +
|
||||||
str(self.lag_external_oam_interface_policy) + "]: ")
|
str(self.lag_external_oam_interface_policy) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -2138,7 +2139,7 @@ class ConfigAssistant():
|
||||||
"external OAM interface.", 80)
|
"external OAM interface.", 80)
|
||||||
print
|
print
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"First external OAM interface member [" +
|
"First external OAM interface member [" +
|
||||||
str(self.lag_external_oam_interface_member0) + "]: ")
|
str(self.lag_external_oam_interface_member0) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -2161,7 +2162,7 @@ class ConfigAssistant():
|
||||||
self.lag_external_oam_interface_member0 = ""
|
self.lag_external_oam_interface_member0 = ""
|
||||||
continue
|
continue
|
||||||
|
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Second external oam interface member [" +
|
"Second external oam interface member [" +
|
||||||
str(self.lag_external_oam_interface_member1) + "]: ")
|
str(self.lag_external_oam_interface_member1) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -2186,7 +2187,7 @@ class ConfigAssistant():
|
||||||
else:
|
else:
|
||||||
print "Interface does not exist"
|
print "Interface does not exist"
|
||||||
self.lag_external_oam_interface_member1 = ""
|
self.lag_external_oam_interface_member1 = ""
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"Do you want a single physical member in the bond "
|
"Do you want a single physical member in the bond "
|
||||||
"interface [y/n]: ")
|
"interface [y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
|
@ -2197,8 +2198,8 @@ class ConfigAssistant():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("External OAM subnet [" +
|
user_input = input("External OAM subnet [" +
|
||||||
str(self.external_oam_subnet) + "]: ")
|
str(self.external_oam_subnet) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -2216,8 +2217,8 @@ class ConfigAssistant():
|
||||||
)
|
)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input("External OAM gateway address [" +
|
user_input = input("External OAM gateway address [" +
|
||||||
str(self.external_oam_subnet[1]) + "]: ")
|
str(self.external_oam_subnet[1]) + "]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
elif user_input == "":
|
elif user_input == "":
|
||||||
|
@ -4589,7 +4590,7 @@ class ConfigAssistant():
|
||||||
|
|
||||||
if not configfile and not default_config:
|
if not configfile and not default_config:
|
||||||
while True:
|
while True:
|
||||||
user_input = raw_input(
|
user_input = input(
|
||||||
"\nApply the above configuration? [y/n]: ")
|
"\nApply the above configuration? [y/n]: ")
|
||||||
if user_input.lower() == 'q':
|
if user_input.lower() == 'q':
|
||||||
raise UserQuit
|
raise UserQuit
|
||||||
|
|
|
@ -46,6 +46,7 @@ from functools import wraps
|
||||||
from wrapping_formatters import _get_width
|
from wrapping_formatters import _get_width
|
||||||
|
|
||||||
from cgtsclient.common import wrapping_formatters
|
from cgtsclient.common import wrapping_formatters
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
class HelpFormatter(argparse.HelpFormatter):
|
class HelpFormatter(argparse.HelpFormatter):
|
||||||
|
@ -277,7 +278,7 @@ def pt_builder(field_labels, fields, formatters, paging, printer=default_printer
|
||||||
if self.terminal_lines_left > 0:
|
if self.terminal_lines_left > 0:
|
||||||
printer("\n" * (self.terminal_lines_left - 1))
|
printer("\n" * (self.terminal_lines_left - 1))
|
||||||
|
|
||||||
s = raw_input("Press Enter to continue or 'q' to exit...")
|
s = input("Press Enter to continue or 'q' to exit...")
|
||||||
if s == 'q':
|
if s == 'q':
|
||||||
self.quit = True
|
self.quit = True
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -23,6 +23,7 @@ from cgtsclient.v1 import ihost as ihost_utils
|
||||||
from cgtsclient.v1 import iinterface as iinterface_utils
|
from cgtsclient.v1 import iinterface as iinterface_utils
|
||||||
from cgtsclient.v1 import iprofile as iprofile_utils
|
from cgtsclient.v1 import iprofile as iprofile_utils
|
||||||
from cgtsclient.v1 import istor as istor_utils
|
from cgtsclient.v1 import istor as istor_utils
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
def _print_ihost_show(ihost):
|
def _print_ihost_show(ihost):
|
||||||
|
@ -694,7 +695,7 @@ def do_host_downgrade(cc, args):
|
||||||
'Only proceed once the system data has been copied to another '
|
'Only proceed once the system data has been copied to another '
|
||||||
'system.\n'
|
'system.\n'
|
||||||
'Are you absolutely sure you want to continue? [yes/N]: ')
|
'Are you absolutely sure you want to continue? [yes/N]: ')
|
||||||
confirm = raw_input(warning_message)
|
confirm = input(warning_message)
|
||||||
if confirm != 'yes':
|
if confirm != 'yes':
|
||||||
print "Operation cancelled."
|
print "Operation cancelled."
|
||||||
return
|
return
|
||||||
|
@ -723,7 +724,7 @@ def do_host_upgrade(cc, args):
|
||||||
'Only proceed once the system data has been copied to another '
|
'Only proceed once the system data has been copied to another '
|
||||||
'system.\n'
|
'system.\n'
|
||||||
'Are you absolutely sure you want to continue? [yes/N]: ')
|
'Are you absolutely sure you want to continue? [yes/N]: ')
|
||||||
confirm = raw_input(warning_message)
|
confirm = input(warning_message)
|
||||||
if confirm != 'yes':
|
if confirm != 'yes':
|
||||||
print "Operation cancelled."
|
print "Operation cancelled."
|
||||||
return
|
return
|
||||||
|
|
|
@ -15,6 +15,7 @@ from cgtsclient.common import utils
|
||||||
from cgtsclient import exc
|
from cgtsclient import exc
|
||||||
from cgtsclient.v1 import ihost as ihost_utils
|
from cgtsclient.v1 import ihost as ihost_utils
|
||||||
import math
|
import math
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
def _print_idisk_show(idisk):
|
def _print_idisk_show(idisk):
|
||||||
|
@ -103,7 +104,7 @@ def do_host_disk_wipe(cc, args):
|
||||||
("WARNING: This operation is irreversible and all data on the "
|
("WARNING: This operation is irreversible and all data on the "
|
||||||
"specified disk will be lost.\n"
|
"specified disk will be lost.\n"
|
||||||
"Continue [yes/N]: ")
|
"Continue [yes/N]: ")
|
||||||
confirm = raw_input(warning_message)
|
confirm = input(warning_message)
|
||||||
if confirm != 'yes':
|
if confirm != 'yes':
|
||||||
print "Operation cancelled."
|
print "Operation cancelled."
|
||||||
return
|
return
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
from cgtsclient.common import constants
|
from cgtsclient.common import constants
|
||||||
from cgtsclient.common import utils
|
from cgtsclient.common import utils
|
||||||
from cgtsclient import exc
|
from cgtsclient import exc
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
def _print_isystem_show(isystem):
|
def _print_isystem_show(isystem):
|
||||||
|
@ -126,7 +127,7 @@ def do_modify(cc, args):
|
||||||
'before continue.\n'
|
'before continue.\n'
|
||||||
'Are you sure you want to continue [yes/N]: ' % mode_text)
|
'Are you sure you want to continue [yes/N]: ' % mode_text)
|
||||||
|
|
||||||
confirm = raw_input(warning_message)
|
confirm = input(warning_message)
|
||||||
if confirm != 'yes':
|
if confirm != 'yes':
|
||||||
print "Operation cancelled."
|
print "Operation cancelled."
|
||||||
return
|
return
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
from cgtsclient.common import constants
|
from cgtsclient.common import constants
|
||||||
from cgtsclient.common import utils
|
from cgtsclient.common import utils
|
||||||
from cgtsclient import exc
|
from cgtsclient import exc
|
||||||
|
from six.moves import input
|
||||||
|
|
||||||
|
|
||||||
def _print_upgrade_show(obj):
|
def _print_upgrade_show(obj):
|
||||||
|
@ -128,12 +129,12 @@ def do_upgrade_abort(cc, args):
|
||||||
'revert to the state when controller-0 was last active.\n\n'
|
'revert to the state when controller-0 was last active.\n\n'
|
||||||
'Continue [yes/N]: ')
|
'Continue [yes/N]: ')
|
||||||
|
|
||||||
confirm = raw_input(warning_message)
|
confirm = input(warning_message)
|
||||||
if confirm != 'yes':
|
if confirm != 'yes':
|
||||||
print "Operation cancelled."
|
print "Operation cancelled."
|
||||||
return
|
return
|
||||||
elif abort_required:
|
elif abort_required:
|
||||||
confirm = raw_input("Type 'abort' to confirm: ")
|
confirm = input("Type 'abort' to confirm: ")
|
||||||
if confirm != 'abort':
|
if confirm != 'abort':
|
||||||
print "Operation cancelled."
|
print "Operation cancelled."
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue