Skip to content

Commit

Permalink
removes Pathlib, fixes typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
toydarian authored and gcalacoci committed Jul 17, 2024
1 parent 198bf42 commit b66e10a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions barman/clients/walrestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import subprocess
import sys
import time
from pathlib import Path

import barman
from barman.utils import force_str
Expand Down Expand Up @@ -75,7 +74,7 @@ def main(args=None):
return # never reached

# If the file is present in SPOOL_DIR use it and terminate
try_deliver_from_spool(config, dest_file)
try_deliver_from_spool(config, dest_file.name)

# If required load the list of files to download in parallel
additional_files = peek_additional_files(config)
Expand Down Expand Up @@ -242,20 +241,20 @@ def try_deliver_from_spool(config, dest_file):
return otherwise.
:param argparse.Namespace config: the configuration from command line
:param dest_file: The destination file object
:param dest_file: The path to the destination file
"""
spool_file = Path(config.spool_dir, config.wal_name)
spool_file = str(os.path.join(config.spool_dir, config.wal_name))

# id the file is not present, give up
if not spool_file.exists():
if not os.path.exists(spool_file):
return

try:
shutil.move(spool_file, dest_file)
sys.exit(0)
except IOError as e:
exit_with_error(
"Failure copying %s to %s: %s" % (spool_file, dest_file.name, e)
"Failure moving %s to %s: %s" % (spool_file, dest_file, e)
)


Expand Down

0 comments on commit b66e10a

Please sign in to comment.