Fix replacing targets in add_targets()

Match the pattern in add_target() where if the filepath already exists
in roleinfo['paths'] it is updated to replace the existing entry with
the new fileinfo.

Signed-off-by: Joshua Lock <jlock@vmware.com>
This commit is contained in:
Joshua Lock 2020-03-25 11:25:20 +00:00
parent 095fd40dcb
commit 468a380ea4

View file

@ -2027,10 +2027,10 @@ def add_targets(self, list_of_targets):
for relative_target in relative_list_of_targets:
if relative_target not in roleinfo['paths']:
logger.debug('Adding new target: ' + repr(relative_target))
roleinfo['paths'].update({relative_target: {}})
else:
logger.debug('Replacing target: ' + repr(relative_target))
roleinfo['paths'].update({relative_target: {}})
tuf.roledb.update_roleinfo(self.rolename, roleinfo,
repository_name=self._repository_name)