Skip to content

Instantly share code, notes, and snippets.

@yasn77
Created January 27, 2020 01:51
Show Gist options
  • Save yasn77/ea8cdb6900443ce93b24a1cd731e0991 to your computer and use it in GitHub Desktop.
Save yasn77/ea8cdb6900443ce93b24a1cd731e0991 to your computer and use it in GitHub Desktop.
Helm/Kong PR 13 (migrate plugin values)
#!/usr/bin/env python
import ruamel.yaml
import sys
yaml = ruamel.yaml.YAML()
with open(sys.argv[1], 'r') as f:
values = yaml.load(f)
values['_plugins'] = values['plugins']
values['plugins'] = list()
for (k, v) in values['_plugins'].items():
[values['plugins'].append({
'name': i['pluginName'],
'storageName': i['name'],
'storageType': k[0:-1]}) for i in v]
del values['_plugins']
with open(sys.argv[1], 'w') as f:
yaml.dump(values, f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment