mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
cli: s/yes_or_no/yes_no/g
This commit is contained in:
parent
b3a72bcb95
commit
b3719f25ac
@ -220,7 +220,7 @@ def prompt_virt(caps, arch, req_virt_type, req_accel):
|
|||||||
"(yes or no)? This will allow you to run "
|
"(yes or no)? This will allow you to run "
|
||||||
"unmodified operating systems.")
|
"unmodified operating systems.")
|
||||||
|
|
||||||
if cli.prompt_for_yes_or_no(prompt_txt, ""):
|
if cli.prompt_for_yes_no(prompt_txt, ""):
|
||||||
req_virt_type = "hvm"
|
req_virt_type = "hvm"
|
||||||
else:
|
else:
|
||||||
req_virt_type = "xen"
|
req_virt_type = "xen"
|
||||||
@ -244,7 +244,7 @@ def prompt_virt(caps, arch, req_virt_type, req_accel):
|
|||||||
prompt_txt = (_("Would you like to use %s acceleration? "
|
prompt_txt = (_("Would you like to use %s acceleration? "
|
||||||
"(yes or no)") % accel_type)
|
"(yes or no)") % accel_type)
|
||||||
|
|
||||||
req_accel = cli.prompt_for_yes_or_no(prompt_txt, "")
|
req_accel = cli.prompt_for_yes_no(prompt_txt, "")
|
||||||
|
|
||||||
return (req_virt_type, req_accel)
|
return (req_virt_type, req_accel)
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ def is_prompt():
|
|||||||
return doprompt
|
return doprompt
|
||||||
|
|
||||||
|
|
||||||
def yes_or_no_convert(s):
|
def _yes_no_convert(s):
|
||||||
if s is None:
|
if s is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -337,8 +337,8 @@ def yes_or_no_convert(s):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def yes_or_no(s):
|
def _yes_no(s):
|
||||||
ret = yes_or_no_convert(s)
|
ret = _yes_no_convert(s)
|
||||||
if ret is None:
|
if ret is None:
|
||||||
raise ValueError(_("A yes or no response is required"))
|
raise ValueError(_("A yes or no response is required"))
|
||||||
return ret
|
return ret
|
||||||
@ -360,8 +360,8 @@ def prompt_for_input(noprompt_err, prompt="", val=None, failed=False):
|
|||||||
return sys.stdin.readline().strip()
|
return sys.stdin.readline().strip()
|
||||||
|
|
||||||
|
|
||||||
def prompt_for_yes_or_no(warning, question):
|
def prompt_for_yes_no(warning, question):
|
||||||
"""catches yes_or_no errors and ensures a valid bool return"""
|
"""catches yes_no errors and ensures a valid bool return"""
|
||||||
if force:
|
if force:
|
||||||
logging.debug("Forcing return value of True to prompt '%s'")
|
logging.debug("Forcing return value of True to prompt '%s'")
|
||||||
return True
|
return True
|
||||||
@ -375,7 +375,7 @@ def prompt_for_yes_or_no(warning, question):
|
|||||||
|
|
||||||
inp = prompt_for_input(errmsg, msg, None)
|
inp = prompt_for_input(errmsg, msg, None)
|
||||||
try:
|
try:
|
||||||
res = yes_or_no(inp)
|
res = _yes_no(inp)
|
||||||
break
|
break
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
logging.error(e)
|
logging.error(e)
|
||||||
@ -482,7 +482,7 @@ def disk_prompt(conn, origpath, origsize, origsparse,
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if warn_overwrite or is_prompt():
|
if warn_overwrite or is_prompt():
|
||||||
return not prompt_for_yes_or_no(msg, askmsg)
|
return not prompt_for_yes_no(msg, askmsg)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def prompt_inuse_conflict(dev):
|
def prompt_inuse_conflict(dev):
|
||||||
@ -495,7 +495,7 @@ def disk_prompt(conn, origpath, origsize, origsparse,
|
|||||||
|
|
||||||
msg = (_("Disk %s is already in use by other guests %s." %
|
msg = (_("Disk %s is already in use by other guests %s." %
|
||||||
(dev.path, names)))
|
(dev.path, names)))
|
||||||
return not prompt_for_yes_or_no(msg, askmsg)
|
return not prompt_for_yes_no(msg, askmsg)
|
||||||
|
|
||||||
def prompt_size_conflict(dev):
|
def prompt_size_conflict(dev):
|
||||||
"""
|
"""
|
||||||
@ -507,7 +507,7 @@ def disk_prompt(conn, origpath, origsize, origsparse,
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
if errmsg:
|
if errmsg:
|
||||||
return not prompt_for_yes_or_no(errmsg, askmsg)
|
return not prompt_for_yes_no(errmsg, askmsg)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -619,7 +619,7 @@ def get_vcpus(guest, vcpus, check_cpu):
|
|||||||
"but performance will be poor. ") % (guest.vcpus, pcpus)
|
"but performance will be poor. ") % (guest.vcpus, pcpus)
|
||||||
askmsg = _("Are you sure? (yes or no)")
|
askmsg = _("Are you sure? (yes or no)")
|
||||||
|
|
||||||
if not prompt_for_yes_or_no(msg, askmsg):
|
if not prompt_for_yes_no(msg, askmsg):
|
||||||
nice_exit()
|
nice_exit()
|
||||||
|
|
||||||
|
|
||||||
@ -1177,13 +1177,13 @@ def parse_boot(guest, optstr):
|
|||||||
set_param = _build_set_param(guest.os, opts)
|
set_param = _build_set_param(guest.os, opts)
|
||||||
|
|
||||||
def convert_menu(val):
|
def convert_menu(val):
|
||||||
val = yes_or_no_convert(val)
|
val = _yes_no_convert(val)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
return val
|
return val
|
||||||
fail(_("--boot menu must be 'on' or 'off'"))
|
fail(_("--boot menu must be 'on' or 'off'"))
|
||||||
|
|
||||||
def convert_useserial(val):
|
def convert_useserial(val):
|
||||||
val = yes_or_no_convert(val)
|
val = _yes_no_convert(val)
|
||||||
if val is not None:
|
if val is not None:
|
||||||
return val
|
return val
|
||||||
fail(_("--boot useserial must be 'on' or 'off'"))
|
fail(_("--boot useserial must be 'on' or 'off'"))
|
||||||
@ -1228,7 +1228,7 @@ def parse_security(guest, optstr):
|
|||||||
# Beware, adding boolean options here could upset label comma handling
|
# Beware, adding boolean options here could upset label comma handling
|
||||||
mode = get_opt_param(opts, "type")
|
mode = get_opt_param(opts, "type")
|
||||||
label = get_opt_param(opts, "label")
|
label = get_opt_param(opts, "label")
|
||||||
relabel = yes_or_no_convert(get_opt_param(opts, "relabel"))
|
relabel = _yes_no_convert(get_opt_param(opts, "relabel"))
|
||||||
|
|
||||||
# Try to fix up label if it contained commas
|
# Try to fix up label if it contained commas
|
||||||
if label:
|
if label:
|
||||||
@ -1274,18 +1274,18 @@ def parse_features(guest, optstr):
|
|||||||
opts = parse_optstr(optstr)
|
opts = parse_optstr(optstr)
|
||||||
set_param = _build_set_param(guest.features, opts)
|
set_param = _build_set_param(guest.features, opts)
|
||||||
|
|
||||||
set_param("acpi", "acpi", convert_cb=yes_or_no_convert)
|
set_param("acpi", "acpi", convert_cb=_yes_no_convert)
|
||||||
set_param("apic", "apic", convert_cb=yes_or_no_convert)
|
set_param("apic", "apic", convert_cb=_yes_no_convert)
|
||||||
set_param("pae", "pae", convert_cb=yes_or_no_convert)
|
set_param("pae", "pae", convert_cb=_yes_no_convert)
|
||||||
set_param("privnet", "privnet", convert_cb=yes_or_no_convert)
|
set_param("privnet", "privnet", convert_cb=_yes_no_convert)
|
||||||
set_param("hap", "hap", convert_cb=yes_or_no_convert)
|
set_param("hap", "hap", convert_cb=_yes_no_convert)
|
||||||
set_param("viridian", "viridian", convert_cb=yes_or_no_convert)
|
set_param("viridian", "viridian", convert_cb=_yes_no_convert)
|
||||||
set_param("eoi", "eoi", convert_cb=yes_or_no_convert)
|
set_param("eoi", "eoi", convert_cb=_yes_no_convert)
|
||||||
|
|
||||||
set_param("hyperv_vapic", "hyperv_vapic", convert_cb=yes_or_no_convert)
|
set_param("hyperv_vapic", "hyperv_vapic", convert_cb=_yes_no_convert)
|
||||||
set_param("hyperv_relaxed", "hyperv_relaxed", convert_cb=yes_or_no_convert)
|
set_param("hyperv_relaxed", "hyperv_relaxed", convert_cb=_yes_no_convert)
|
||||||
set_param("hyperv_spinlocks", "hyperv_spinlocks",
|
set_param("hyperv_spinlocks", "hyperv_spinlocks",
|
||||||
convert_cb=yes_or_no_convert)
|
convert_cb=_yes_no_convert)
|
||||||
set_param("hyperv_spinlocks_retries", "hyperv_spinlocks_retries")
|
set_param("hyperv_spinlocks_retries", "hyperv_spinlocks_retries")
|
||||||
|
|
||||||
_check_leftover_opts(opts)
|
_check_leftover_opts(opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user