Commit a7edaab5 authored by Antoine Catton's avatar Antoine Catton

FIX: Use shutil.move instead of os.rename in downloader recipe

os.rename failed when it move the file across devices/mount-points.
shutil.move allow to rename/move a file from one physical device to
another.
parent 6242a73f
...@@ -59,7 +59,7 @@ def service(args): ...@@ -59,7 +59,7 @@ def service(args):
return 127 # Not-null return code return 127 # Not-null return code
if not args['archive']: if not args['archive']:
os.rename(tmpoutput, args['output']) shutil.move(tmpoutput, args['output'])
else: else:
# XXX: hardcoding path # XXX: hardcoding path
extract_dir = os.path.join(tmpdir, 'extract') extract_dir = os.path.join(tmpdir, 'extract')
...@@ -74,8 +74,8 @@ def service(args): ...@@ -74,8 +74,8 @@ def service(args):
if len(archive_content) == 1 and \ if len(archive_content) == 1 and \
os.path.isfile(os.path.join(extract_dir, os.path.isfile(os.path.join(extract_dir,
archive_content[0])): archive_content[0])):
os.rename(os.path.join(extract_dir, shutil.move(os.path.join(extract_dir,
archive_content[0]), archive_content[0]),
args['output']) args['output'])
else: else:
return 127 # Not-null return code return 127 # Not-null return code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment