88import os
99import shutil
1010import sys
11- from datetime import datetime , timedelta , timezone
1211
13- from tuf .ngclient import Updater , UpdaterConfig
12+ from tuf .ngclient import Updater
1413
1514
1615def init (metadata_dir : str , trusted_root : str ) -> None :
@@ -21,23 +20,13 @@ def init(metadata_dir: str, trusted_root: str) -> None:
2120 print (f"python-tuf test client: Initialized repository in { metadata_dir } " )
2221
2322
24- def refresh (
25- metadata_url : str ,
26- metadata_dir : str ,
27- days_in_future : str ,
28- max_root_rotations : int ,
29- ) -> None :
23+ def refresh (metadata_url : str , metadata_dir : str ) -> None :
3024 """Refresh local metadata from remote"""
3125
3226 updater = Updater (
3327 metadata_dir ,
3428 metadata_url ,
35- config = UpdaterConfig (max_root_rotations = int (max_root_rotations )),
3629 )
37- if days_in_future != "0" :
38- day_int = int (days_in_future )
39- day_in_future = datetime .now (timezone .utc ) + timedelta (days = day_int )
40- updater ._trusted_set .reference_time = day_in_future # noqa: SLF001
4130 updater .refresh ()
4231 print (f"python-tuf test client: Refreshed metadata in { metadata_dir } " )
4332
@@ -56,7 +45,6 @@ def download_target(
5645 metadata_url ,
5746 download_dir ,
5847 target_base_url ,
59- config = UpdaterConfig (prefix_targets_with_hash = False ),
6048 )
6149 target_info = updater .get_targetinfo (target_name )
6250 if not target_info :
@@ -73,10 +61,6 @@ def main() -> int:
7361 parser .add_argument ("--target-name" , required = False )
7462 parser .add_argument ("--target-dir" , required = False )
7563 parser .add_argument ("--target-base-url" , required = False )
76- parser .add_argument ("--days-in-future" , required = False , default = "0" )
77- parser .add_argument (
78- "--max-root-rotations" , required = False , default = 32 , type = int
79- )
8064
8165 sub_command = parser .add_subparsers (dest = "sub_command" )
8266 init_parser = sub_command .add_parser (
@@ -104,8 +88,6 @@ def main() -> int:
10488 refresh (
10589 command_args .metadata_url ,
10690 command_args .metadata_dir ,
107- command_args .days_in_future ,
108- command_args .max_root_rotations ,
10991 )
11092 elif command_args .sub_command == "download" :
11193 download_target (
0 commit comments