Skip to content

Commit

Permalink
Change content app's working directory dynamically
Browse files Browse the repository at this point in the history
As of this commit, content app is no longer storing temporary files in the /var/run/ directory. The temporary files were created during on-demand downloading and were not removed until, e.g., restarting pulp services.

closes #9000
  • Loading branch information
lubosmj committed Jul 21, 2021
1 parent 9e22dda commit 49a9f8a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/9000.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the content app's working directory to ``WORKING_DIRECTORY`` specified in ``settings.py``.
2 changes: 2 additions & 0 deletions pulpcore/content/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def save_heartbeat_blocking():


async def server(*args, **kwargs):
os.chdir(settings.WORKING_DIRECTORY)

asyncio.ensure_future(_heartbeat())
for pulp_plugin in pulp_plugin_configs():
if pulp_plugin.name != "pulpcore.app":
Expand Down
5 changes: 5 additions & 0 deletions pulpcore/content/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,11 @@ def _save_artifact(self, download_result, remote_artifact):
**download_result.artifact_attributes, file=download_result.path
)
artifact.save()
else:
#
#
os.unlink(download_result.path)

update_content_artifact = True
if content_artifact._state.adding:
# This is the first time pull-through content was requested.
Expand Down

0 comments on commit 49a9f8a

Please sign in to comment.