mirror of
https://github.com/truenas/charts.git
synced 2026-04-23 18:10:06 +08:00
* nginx-proxy-manager: allow changing puid/pgid * restore quites * restore quotes * fix defaults * make better
39 lines
977 B
Python
Executable File
39 lines
977 B
Python
Executable File
#!/usr/bin/python3
|
|
import json
|
|
import os
|
|
import sys
|
|
|
|
|
|
def migrate(values):
|
|
storageKey = 'npmStorage'
|
|
storages = ['data', 'certs']
|
|
|
|
|
|
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'}
|
|
|
|
# If there is no npmID, add it defaults to
|
|
# 1000 to account for existing installations
|
|
if values.get('npmID', None) is None:
|
|
values.update({
|
|
'npmID': {
|
|
'user': 1000,
|
|
'group': 1000
|
|
}
|
|
})
|
|
|
|
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()))))
|