From a8b443dc93feff5ba08329ddf412b628f23ce953 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Fri, 17 Jul 2026 23:50:10 +0200 Subject: [PATCH] Provide clearer error on restore with mismatched dump format Restoring a YAML dump without --yaml (or vice versa) previously reported 'Cannot restore without keys, this may be a redacted dump'. Point at the actual format of the dump instead when the keys file exists in the other format. --- confluent_server/confluent/config/configmanager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 328956f4..02e32bf7 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -3136,6 +3136,11 @@ async def restore_db_from_directory(location, password, merge=False, skipped=Non kdd = None except IOError as e: if e.errno == 2: + otherformat = 'json' if format == 'yaml' else 'yaml' + if os.path.exists(os.path.join(location, f'keys.{otherformat}')): + raise Exception( + f'Cannot find keys.{format}, but keys.{otherformat} ' + f'exists; this appears to be a {otherformat} format dump') raise Exception("Cannot restore without keys, this may be a " "redacted dump") if not merge: