Drop default from ask_user_yesno question

There is no default for ask_user_yesno() since an empty answer instead
just repeats the question. Drop the unnecessary parameter.

Change-Id: I207bccbcbd31f831765e74a20c503b695790c0f5
This commit is contained in:
Dr. Jens Harbott 2022-12-27 11:20:05 +01:00
parent 348eb79632
commit 69182a04b2

@ -28,16 +28,15 @@ from openstackclient.identity import common as identity_common
LOG = logging.getLogger(__name__)
def ask_user_yesno(msg, default=True):
def ask_user_yesno(msg):
"""Ask user Y/N question
:param str msg: question text
:param bool default: default value
:return bool: User choice
"""
while True:
answer = getpass._raw_input(
'{} [{}]: '.format(msg, 'y/N' if not default else 'Y/n'))
'{} [{}]: '.format(msg, 'y/n'))
if answer in ('y', 'Y', 'yes'):
return True
elif answer in ('n', 'N', 'no'):
@ -129,8 +128,7 @@ class ProjectCleanup(command.Command):
return
confirm = ask_user_yesno(
_("These resources will be deleted. Are you sure"),
default=False)
_("These resources will be deleted. Are you sure"))
if confirm:
self.log.warning(_('Deleting resources'))