Merge "Drop default from ask_user_yesno question"

This commit is contained in:
Zuul 2023-02-22 12:32:22 +00:00 committed by Gerrit Code Review
commit 43f04c874f

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