From d92d20a97ac8e65524ccbfd7487d9c8899948544 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 22 May 2025 15:29:56 +0200 Subject: [PATCH] Support Click 8.2+ Click 8.2 and above will now force an abort if a confirmation prompt isn't answered, rather than raising the CLIAbort that is expected. Catch this exception so that our own exceptions are raised. --- SoftLayer/CLI/formatting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SoftLayer/CLI/formatting.py b/SoftLayer/CLI/formatting.py index b9eca571e..b4c9a98f7 100644 --- a/SoftLayer/CLI/formatting.py +++ b/SoftLayer/CLI/formatting.py @@ -260,7 +260,10 @@ def no_going_back(confirmation): prompt = f"This action cannot be undone! Type '{confirmation}' or press Enter to abort" - ans = click.prompt(prompt, default='', show_default=False) + try: + ans = click.prompt(prompt, default='', show_default=False) + except click.exceptions.Abort: + return False if ans.lower() == str(confirmation).lower(): return True