mirror of
https://github.com/xcat2/confluent.git
synced 2026-08-03 16:07:00 +00:00
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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user