forked from ckan/ckan-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix file move and remove in archiver tasks
- Loading branch information
1 parent
be5ffe3
commit 46812af
Showing
2 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
ckan/patches/ckanext-archiver/01_copy_archive_resource.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
index 06a1758..08a3ba6 100644 | ||
--- a/ckanext/archiver/tasks.py | ||
+++ b/ckanext/archiver/tasks.py | ||
@@ -568,14 +568,14 @@ def archive_resource(context, resource, log, result=None, url_timeout=30): | ||
except Exception: | ||
file_name = "resource" | ||
|
||
- # move the temp file to the resource's archival directory | ||
- saved_file = os.path.join(archive_dir, file_name) | ||
- shutil.move(result['saved_file'], saved_file) | ||
- log.info('Going to do chmod: %s', saved_file) | ||
try: | ||
- os.chmod(saved_file, 0o644) # allow other users to read it | ||
+ # move the temp file to the resource's archival directory | ||
+ saved_file = os.path.join(archive_dir, file_name) | ||
+ shutil.copy(result['saved_file'], saved_file) | ||
+ log.info('File moved : %s', saved_file) | ||
+ os.remove(result['saved_file']) | ||
except Exception as e: | ||
- log.error('chmod failed %s: %s', saved_file, e) | ||
+ log.error("move the temp file to the resource's archival directory failed %s: %s", saved_file, e) | ||
raise | ||
log.info('Archived resource as: %s', saved_file) | ||
|
||
|
||
~ | ||
~ |
This file was deleted.
Oops, something went wrong.