Changes Initial commit
This commit is contained in:
17
ota_agent/manifest_store.py
Normal file
17
ota_agent/manifest_store.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from .models import UpdateManifest
|
||||
|
||||
|
||||
class ManifestStore:
|
||||
def __init__(self, manifest_dir: str) -> None:
|
||||
self.path = Path(manifest_dir)
|
||||
self.path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
def save(self, manifest: UpdateManifest) -> Path:
|
||||
target = self.path / f"{manifest.release_version}.json"
|
||||
target.write_text(json.dumps(manifest.model_dump(), ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
return target
|
||||
Reference in New Issue
Block a user