8
8
import os
9
9
import shutil
10
10
import sys
11
- from datetime import datetime , timedelta , timezone
12
11
13
- from tuf .ngclient import Updater , UpdaterConfig
12
+ from tuf .ngclient import Updater
14
13
15
14
16
15
def init (metadata_dir : str , trusted_root : str ) -> None :
@@ -21,23 +20,13 @@ def init(metadata_dir: str, trusted_root: str) -> None:
21
20
print (f"python-tuf test client: Initialized repository in { metadata_dir } " )
22
21
23
22
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 :
30
24
"""Refresh local metadata from remote"""
31
25
32
26
updater = Updater (
33
27
metadata_dir ,
34
28
metadata_url ,
35
- config = UpdaterConfig (max_root_rotations = int (max_root_rotations )),
36
29
)
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
41
30
updater .refresh ()
42
31
print (f"python-tuf test client: Refreshed metadata in { metadata_dir } " )
43
32
@@ -56,7 +45,6 @@ def download_target(
56
45
metadata_url ,
57
46
download_dir ,
58
47
target_base_url ,
59
- config = UpdaterConfig (prefix_targets_with_hash = False ),
60
48
)
61
49
target_info = updater .get_targetinfo (target_name )
62
50
if not target_info :
@@ -73,10 +61,6 @@ def main() -> int:
73
61
parser .add_argument ("--target-name" , required = False )
74
62
parser .add_argument ("--target-dir" , required = False )
75
63
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
- )
80
64
81
65
sub_command = parser .add_subparsers (dest = "sub_command" )
82
66
init_parser = sub_command .add_parser (
@@ -104,8 +88,6 @@ def main() -> int:
104
88
refresh (
105
89
command_args .metadata_url ,
106
90
command_args .metadata_dir ,
107
- command_args .days_in_future ,
108
- command_args .max_root_rotations ,
109
91
)
110
92
elif command_args .sub_command == "download" :
111
93
download_target (
0 commit comments