From 5ea1f6398a27047a5a299c42b7428c6248d45e0e Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Mon, 30 Mar 2020 18:39:10 +0100 Subject: [PATCH] Remove custom parameter from add_target_to_bin() 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 --- tuf/repository_tool.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/tuf/repository_tool.py b/tuf/repository_tool.py index 6b132a3a43..3f7115c95a 100755 --- a/tuf/repository_tool.py +++ b/tuf/repository_tool.py @@ -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): """ Add the fileinfo of 'target_filepath' to the expected hashed bin, if the @@ -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. @@ -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.) @@ -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)