Files
chart/library/ix-dev/community/chia/migrations/migrate
Stavros Kois 85d2fab14d NAS-122030 / 23.10 / Adds check to only render hostPath key if it has a value (#1210)
* Remove hostPath key from values.yaml

* Add migrations

* bump

* rename migration files and make it safer

* fix wrongly nested dict
2023-05-30 16:23:29 +03:00

30 lines
708 B
Python
Executable File

#!/usr/bin/python3
import json
import os
import sys
def migrate(values):
storageKey = 'chiaStorage'
storages = ['data', 'plots']
for storage in storages:
check_val = values.get(storageKey, {}).get(storage, {})
if not isinstance(check_val, dict) or not check_val or check_val.get('type', 'hostPath') == 'hostPath':
continue
values[storageKey][storage] = {key: value for key, value in check_val.items() if key != 'hostPath'}
return values
if __name__ == '__main__':
if len(sys.argv) != 2:
exit(1)
if os.path.exists(sys.argv[1]):
with open(sys.argv[1], 'r') as f:
print(json.dumps(migrate(json.loads(f.read()))))