Created
January 27, 2020 01:51
-
-
Save yasn77/ea8cdb6900443ce93b24a1cd731e0991 to your computer and use it in GitHub Desktop.
Helm/Kong PR 13 (migrate plugin values)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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