Skip to content

Commit

Permalink
Remove custom parameter from add_target_to_bin()
Browse files Browse the repository at this point in the history
We intend to deprecate the custom parameter of add_target() in favour
of using the fileinfo parameter with the custom value populated,
therefore it does not make sense to _add_ the custom parameter to
add_target_to_bin()

Signed-off-by: Joshua Lock <[email protected]>
  • Loading branch information
joshuagl committed Mar 30, 2020
1 parent f362544 commit 5ea1f63
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tuf/repository_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2556,8 +2556,7 @@ def delegate_hashed_bins(self, list_of_targets, keys_of_hashed_bins,



def add_target_to_bin(self, target_filepath, number_of_bins, custom=None,
fileinfo=None):
def add_target_to_bin(self, target_filepath, number_of_bins, fileinfo=None):
"""
<Purpose>
Add the fileinfo of 'target_filepath' to the expected hashed bin, if the
Expand All @@ -2578,9 +2577,6 @@ def add_target_to_bin(self, target_filepath, number_of_bins, custom=None,
The number of delegated roles, or hashed bins, in use by the repository.
Note: 'number_of_bins' must be a power of 2.
custom:
An optional object providing additional information about the file.
fileinfo:
An optional fileinfo object, conforming to tuf.formats.FILEINFO_SCHEMA,
providing full information about the file.
Expand All @@ -2589,9 +2585,6 @@ def add_target_to_bin(self, target_filepath, number_of_bins, custom=None,
securesystemslib.exceptions.FormatError, if 'target_filepath' is
improperly formatted.
securesystemslib.exceptions.Error, if both 'custom' and 'fileinfo' are
passed.
securesystemslib.exceptions.Error, if 'target_filepath' cannot be added to
a hashed bin (e.g., an invalid target filepath, or the expected hashed
bin does not exist.)
Expand Down Expand Up @@ -2621,8 +2614,7 @@ def add_target_to_bin(self, target_filepath, number_of_bins, custom=None,
raise securesystemslib.exceptions.Error(self.rolename + ' does not have'
' a delegated role ' + bin_name)

self._delegated_roles[bin_name].add_target(target_filepath, custom,
fileinfo)
self._delegated_roles[bin_name].add_target(target_filepath, fileinfo)



Expand Down

0 comments on commit 5ea1f63

Please sign in to comment.