From b3cc7dfeb6bc6af4f3076dead84078e723ef9bd4 Mon Sep 17 00:00:00 2001 From: Vladimir Diaz Date: Mon, 12 Feb 2018 17:31:17 -0500 Subject: [PATCH] Correctly delegate paths via add_paths() in repository_tool.py Signed-off-by: Vladimir Diaz --- tuf/repository_tool.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tuf/repository_tool.py b/tuf/repository_tool.py index 9139ce43..8b4803ce 100755 --- a/tuf/repository_tool.py +++ b/tuf/repository_tool.py @@ -1814,6 +1814,10 @@ def add_paths(self, paths, child_rolename): securesystemslib.formats.PATHS_SCHEMA.check_match(paths) tuf.formats.ROLENAME_SCHEMA.check_match(child_rolename) + # A list of relative and verified paths or glob patterns to be added to the + # child role's entry in the parent's delegations field. + relative_paths = [] + # Ensure that 'child_rolename' exists, otherwise it will not have an entry # in the parent role's delegations field. if not tuf.roledb.role_exists(child_rolename, self._repository_name): @@ -1831,6 +1835,8 @@ def add_paths(self, paths, child_rolename): ' repository\'s targets' ' directory: ' + repr(self._targets_directory)) + relative_paths.append(path) + # Get the current role's roleinfo, so that its delegations field can be # updated. roleinfo = tuf.roledb.get_roleinfo(self._rolename, self._repository_name)