remove_same_storage_field 621 B

123456789101112131415161718192021222324
  1. #!/usr/bin/python3
  2. import os
  3. import sys
  4. import yaml
  5. def migrate(values):
  6. if values["storage"].get("is_data_in_the_same_volume", False):
  7. raise Exception(
  8. "You are still using the old storage configuration. "
  9. "You need to migrate your storage configuration first in order to upgrade."
  10. )
  11. values["storage"].pop("is_data_in_the_same_volume")
  12. return values
  13. if __name__ == "__main__":
  14. if len(sys.argv) != 2:
  15. exit(1)
  16. if os.path.exists(sys.argv[1]):
  17. with open(sys.argv[1], "r") as f:
  18. print(yaml.dump(migrate(yaml.safe_load(f.read()))))