55"""Simple repository example application
66
77The application stores metadata and targets in memory, and serves them via http.
8- * Keys are generated at startup
9- * The application simulates a live reposittory by adding a new target every few seconds
8+ Nothing is persisted on disk or loaded from disk. The application simulates a
9+ live repository by adding new target files periodically.
1010"""
1111
1212import argparse
@@ -28,7 +28,7 @@ class ReqHandler(BaseHTTPRequestHandler):
2828 if self .path .startswith ("/metadata/" ) and self .path .endswith (".json" ):
2929 self .get_metadata (self .path [len ("/metadata/" ):- len (".json" )])
3030 elif self .path .startswith ("/targets/" ):
31- self .get_target (self .path [len ("/targets/" ):])
31+ self .get_target (self .path [len ("/targets/" ):])
3232 else :
3333 self .send_error (404 , "Only serving /metadata/*.json" )
3434
@@ -46,7 +46,7 @@ class ReqHandler(BaseHTTPRequestHandler):
4646 self .send_error (404 , f"Role { role } version { ver } not found" )
4747 return
4848
49- # send the metadata json
49+ # send the metadata json
5050 data = repo .role_cache [role ][ver - 1 ].to_bytes ()
5151 self .send_response (200 )
5252 self .send_header ('Content-length' , len (data ))
@@ -80,7 +80,7 @@ class RepositoryServer(HTTPServer):
8080
8181def main (argv : List [str ]) -> None :
8282 """Example repository server"""
83-
83+
8484 parser = argparse .ArgumentParser ()
8585 parser .add_argument ("-v" , "--verbose" , action = "count" )
8686 parser .add_argument ("-p" , "--port" , type = int , default = 8001 )
@@ -92,7 +92,7 @@ def main(argv: List[str]) -> None:
9292 server = RepositoryServer (args .port )
9393 last_change = 0
9494 counter = 0
95-
95+
9696 logger .info (f"Now serving. Root v1 at http://127.0.0.1:{ server .server_port } /metadata/1.root.json" )
9797
9898 while True :
0 commit comments