Skip to content

Commit

Permalink
fix: attempt to create temporary condense location if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Apr 17, 2024
1 parent 8b2ce2f commit 9b04758
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.15.2
- fix: attempt to create temporary condense location if not exists
0.15.1
- fix: add ckanext.dc_serve.tmp_dir for temporary condense location
0.15.0
Expand Down
7 changes: 7 additions & 0 deletions ckanext/dc_serve/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def generate_condensed_resource_job(resource, override=False):
cache_loc = get_ckan_config_option("ckanext.dc_serve.tmp_dir")
if not cache_loc:
cache_loc = None # probably defaults to /tmp in TemporaryDirectory
else:
# Make sure the directory exists and don't panic when we cannot
# create it.
try:
pathlib.Path(cache_loc).mkdir(parents=True, exist_ok=True)
except BaseException:
cache_loc = None

with tempfile.TemporaryDirectory(dir=cache_loc) as ttd_name:
path_cond = pathlib.Path(ttd_name) / "condensed.rtdc"
Expand Down

0 comments on commit 9b04758

Please sign in to comment.