Skip to content

Commit a872eb5

Browse files
committed
Hash bin delegation example: save versioned files
If we have a goal of making metadata that can just be served to clients, then these (and the parent metadata) should have versioned filenames. Change the file names of the delegated files in the hashed_bin_delegation.py to versioned. Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
1 parent b8ea2fb commit a872eb5

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

examples/repo_example/hashed_bin_delegation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ def find_hash_bin(path: str) -> str:
198198

199199
# Sign and persist
200200
# ----------------
201-
# Sign all metadata and persist to temporary directory at CWD for review
202-
# (most notably see 'bins.json' and '80-87.json').
201+
# Sign all metadata and persist to temporary directory at CWD for review using
202+
# versioned file names. Most notably see '1.bins.json' and '1.80-87.json'.
203203

204204
# NOTE: See "Persist metadata" paragraph in 'basic_repo.py' example for more
205205
# details about serialization formats and metadata file name convention.
@@ -211,6 +211,6 @@ def find_hash_bin(path: str) -> str:
211211
signer = SSlibSigner(key)
212212
role.sign(signer)
213213

214-
filename = f"{role_name}.json"
214+
filename = f"1.{role_name}.json"
215215
filepath = os.path.join(TMP_DIR, filename)
216216
role.to_file(filepath, serializer=PRETTY)

tests/test_examples.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -92,39 +92,39 @@ def test_hashed_bin_delegation(self) -> None:
9292
self._run_script_and_assert_files(
9393
"hashed_bin_delegation.py",
9494
[
95-
"bins.json",
96-
"00-07.json",
97-
"08-0f.json",
98-
"10-17.json",
99-
"18-1f.json",
100-
"20-27.json",
101-
"28-2f.json",
102-
"30-37.json",
103-
"38-3f.json",
104-
"40-47.json",
105-
"48-4f.json",
106-
"50-57.json",
107-
"58-5f.json",
108-
"60-67.json",
109-
"68-6f.json",
110-
"70-77.json",
111-
"78-7f.json",
112-
"80-87.json",
113-
"88-8f.json",
114-
"90-97.json",
115-
"98-9f.json",
116-
"a0-a7.json",
117-
"a8-af.json",
118-
"b0-b7.json",
119-
"b8-bf.json",
120-
"c0-c7.json",
121-
"c8-cf.json",
122-
"d0-d7.json",
123-
"d8-df.json",
124-
"e0-e7.json",
125-
"e8-ef.json",
126-
"f0-f7.json",
127-
"f8-ff.json",
95+
"1.bins.json",
96+
"1.00-07.json",
97+
"1.08-0f.json",
98+
"1.10-17.json",
99+
"1.18-1f.json",
100+
"1.20-27.json",
101+
"1.28-2f.json",
102+
"1.30-37.json",
103+
"1.38-3f.json",
104+
"1.40-47.json",
105+
"1.48-4f.json",
106+
"1.50-57.json",
107+
"1.58-5f.json",
108+
"1.60-67.json",
109+
"1.68-6f.json",
110+
"1.70-77.json",
111+
"1.78-7f.json",
112+
"1.80-87.json",
113+
"1.88-8f.json",
114+
"1.90-97.json",
115+
"1.98-9f.json",
116+
"1.a0-a7.json",
117+
"1.a8-af.json",
118+
"1.b0-b7.json",
119+
"1.b8-bf.json",
120+
"1.c0-c7.json",
121+
"1.c8-cf.json",
122+
"1.d0-d7.json",
123+
"1.d8-df.json",
124+
"1.e0-e7.json",
125+
"1.e8-ef.json",
126+
"1.f0-f7.json",
127+
"1.f8-ff.json",
128128
],
129129
)
130130

0 commit comments

Comments
 (0)