Small parser argument fix
Additional changes were necessary. Now it's possible to use either -y or --yes-to-all to get a 'y' answers on all yes/no questions. The result of the parser is explicitly stored on a variable called 'y' on the namespace that the argparse returns. Task: 48626 Story: 2005051 Change-Id: I4760ea2f1f77bee7c11cf7e0e76ee2566f383b19
This commit is contained in:
parent
0c1a53cebd
commit
0fd3ffeff5
@ -314,7 +314,7 @@ def parse_networking(parser: ArgumentParser):
|
||||
""",
|
||||
type=str,
|
||||
default='32000')
|
||||
parser.add_argument("-y", "--yes-to-all", help=
|
||||
parser.add_argument("-y", "--yes-to-all", dest="y", help=
|
||||
"""
|
||||
Automatically answers all yes/no prompts with yes.
|
||||
""",
|
||||
|
@ -284,9 +284,11 @@ def yes_no_prompt(message):
|
||||
Returns:
|
||||
Answer to the prompt(bool)
|
||||
"""
|
||||
if V_BOX_OPTIONS.y == True:
|
||||
question = message + " (y/n)"
|
||||
if V_BOX_OPTIONS.y is True:
|
||||
LOG.info("Automatically answering 'y' to '%s'", question)
|
||||
return True
|
||||
LOG.info("%s (y/n)",message)
|
||||
LOG.info("%s", question)
|
||||
choice = input().lower()
|
||||
if choice == 'y':
|
||||
return True
|
||||
@ -331,7 +333,7 @@ def create_port_forward(hostname, network, local_port, guest_port, guest_ip):
|
||||
)
|
||||
else:
|
||||
LOG.info("Ignoring the creation of the port-forward rule and continuing installation!")
|
||||
|
||||
|
||||
|
||||
|
||||
# pylint: disable=too-many-locals, too-many-branches, too-many-statements
|
||||
|
Loading…
x
Reference in New Issue
Block a user