Skip to content

Commit

Permalink
Create validation data inside the Pulp's working directory
Browse files Browse the repository at this point in the history
closes pulp#2798
  • Loading branch information
lubosmj authored and bmbouter committed Jun 3, 2022
1 parent dd352a3 commit ea3b9c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES/2798.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a bug that disallowed administrators to create a signing service via the pulpcore-manager
utility.
2 changes: 1 addition & 1 deletion pulpcore/app/models/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def validate(self):
Raises:
RuntimeError: If the validation has failed.
"""
with tempfile.TemporaryDirectory(dir=".") as temp_directory_name:
with tempfile.TemporaryDirectory(dir=settings.WORKING_DIRECTORY) as temp_directory_name:
with tempfile.NamedTemporaryFile(dir=temp_directory_name) as temp_file:
temp_file.write(b"arbitrary data")
temp_file.flush()
Expand Down
3 changes: 2 additions & 1 deletion pulpcore/app/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import gnupg

from django.conf import settings
from django.apps import apps
from django.contrib.contenttypes.models import ContentType
from pkg_resources import get_distribution
Expand Down Expand Up @@ -174,7 +175,7 @@ def verify_signature(filepath, public_key, detached_data=None):
When dealing with a detached signature (referenced by the 'filepath' argument), one have to pass
the reference to a data file that was signed by that signature.
"""
with tempfile.TemporaryDirectory(dir=".") as temp_directory_name:
with tempfile.TemporaryDirectory(dir=settings.WORKING_DIRECTORY) as temp_directory_name:
gpg = gnupg.GPG(gnupghome=temp_directory_name)
gpg.import_keys(public_key)
imported_keys = gpg.list_keys()
Expand Down

0 comments on commit ea3b9c4

Please sign in to comment.