INNER CODE UNIT · Python
main
yaojingang/GEOFlow · deployment/generate-upgrade-plan.py:84
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
mode = parser.add_mutually_exclusive_group(required=True)
mode.add_argument("--write", action="store_true", help="Explicitly refresh the inventory")
mode.add_argument("--check", action="store_true", help="Fail if the inventory is stale; never write")
args = parser.parse_args()
root = Path(__file__).resolve().parent.parent
path = root / "deployment/upgrade-plan.json"
if args.check and not path.is_file():
raise ValueError("Upgrade plan is missing")
if path.exists() and path.stat().st_size > 1048576:
raise ValueError("Upgrade plan exceeds the size limit")
plan = json.loads(path.read_text(), object_pairs_hook=unique_object) if path.exists() else {
"schema_version": 1,
"strategy": "maintenance",
"allowed_sources": [],
"migrations": [],
"compatibility": {key: False for key in ("schema", "queue", "cache", "storage")},