Skip to content

Commit 8d4511a

Browse files
committed
Update add_target docstring
Update the docstring to make it clear that 'custom' and 'fileinfo' are mutually exclusive, and further that the 'custom' parameter will be dropped in a future release. Signed-off-by: Joshua Lock <[email protected]>
1 parent dcd0a9b commit 8d4511a

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

tuf/repository_tool.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,12 +1929,6 @@ def add_target(self, filepath, custom=None, fileinfo=None):
19291929
Add a filepath (must be relative to the repository's targets directory)
19301930
to the Targets object.
19311931
1932-
This method does not access the file system. 'filepath' must already
1933-
exist on the file system.
1934-
1935-
If 'filepath' does not exist the file will still be added to 'roleinfo'.
1936-
Only later calls to write() and writeall() will fail.
1937-
19381932
If 'filepath' has already been added, it will be replaced with any new
19391933
file or 'custom' information.
19401934
@@ -1948,11 +1942,21 @@ def add_target(self, filepath, custom=None, fileinfo=None):
19481942
targets directory.
19491943
19501944
custom:
1951-
An optional object providing additional information about the file.
1945+
An optional dictionary providing additional information about the file.
1946+
NOTE: if a custom value is passed, the fileinfo parameter must be None.
1947+
This parameter will be deprecated in a future release of tuf, use of
1948+
the fileinfo parameter is preferred.
19521949
19531950
fileinfo:
1954-
An optional fileinfo object, conforming to tuf.formats.FILEINFO_SCHEMA,
1955-
providing full information about the file.
1951+
An optional fileinfo dictionary, conforming to
1952+
tuf.formats.FILEINFO_SCHEMA, providing full information about the
1953+
file, i.e:
1954+
{ 'length': 101,
1955+
'hashes': { 'sha256': '123EDF...' },
1956+
'version': 2, # optional
1957+
'custom': { 'permissions': '600'} # optional
1958+
}
1959+
NOTE: if a custom value is passed, the fileinfo parameter must be None.
19561960
19571961
<Exceptions>
19581962
securesystemslib.exceptions.FormatError, if 'filepath' is improperly

0 commit comments

Comments
 (0)