mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-24 08:45:13 +00:00
key export: fix exception handling
export_paperkey also must not get an already existing directory.
This commit is contained in:
parent
5eecdfa133
commit
4e6238e7d3
1 changed files with 13 additions and 14 deletions
|
@ -93,15 +93,14 @@ def do_key_export(self, args, repository):
|
||||||
"""Export the repository key for backup"""
|
"""Export the repository key for backup"""
|
||||||
manager = KeyManager(repository)
|
manager = KeyManager(repository)
|
||||||
manager.load_keyblob()
|
manager.load_keyblob()
|
||||||
if args.paper:
|
|
||||||
manager.export_paperkey(args.path)
|
|
||||||
else:
|
|
||||||
try:
|
try:
|
||||||
if args.path is not None and os.path.isdir(args.path):
|
if args.path is not None and os.path.isdir(args.path):
|
||||||
# on Windows, Python raises PermissionError instead of IsADirectoryError
|
# on Windows, Python raises PermissionError instead of IsADirectoryError
|
||||||
# (like on Unix) if the file to open is actually a directory.
|
# (like on Unix) if the file to open is actually a directory.
|
||||||
raise IsADirectoryError
|
raise IsADirectoryError
|
||||||
if args.qr:
|
if args.paper:
|
||||||
|
manager.export_paperkey(args.path)
|
||||||
|
elif args.qr:
|
||||||
manager.export_qr(args.path)
|
manager.export_qr(args.path)
|
||||||
else:
|
else:
|
||||||
manager.export(args.path)
|
manager.export(args.path)
|
||||||
|
|
Loading…
Reference in a new issue