Skip to content

Commit

Permalink
tuf: More repo loading skeleton code
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw committed Mar 18, 2020
1 parent 79c1e82 commit f617964
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions warehouse/tuf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
def includeme(config):
config.add_settings(
{
"tuf.repository": "TODO",
"tuf.keytype": "ed25519",
"tuf.keyid_hash_algorithm": "sha512",
"tuf.consistent_snapshot": True,
Expand Down
2 changes: 1 addition & 1 deletion warehouse/tuf/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def add_target(task, request, file):

with utils.RepoLock(r):
fileinfo = utils.make_fileinfo(file)
repository = utils.open_repository(request)
repository = utils.load_repository(request)

repository.add_target_to_bin(file.path, fileinfo=fileinfo)

Expand Down
7 changes: 5 additions & 2 deletions warehouse/tuf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# limitations under the License.

import tuf.formats
import tuf.repository_tool


def make_fileinfo(file, custom=None):
Expand All @@ -27,8 +28,10 @@ def make_fileinfo(file, custom=None):
return fileinfo


def open_repository(request):
pass
def load_repository(request):
return tuf.repository_tool.load_repository(
request.registry.settings["tuf.repository"]
)


class RepoLock:
Expand Down

0 comments on commit f617964

Please sign in to comment.