Last active
May 4, 2018 18:01
-
-
Save goneri/e375b62d6e7b6e3621bceb40b768def1 to your computer and use it in GitHub Desktop.
convert os-net-config template to the new format (OSP10 to OSP13)
This file contains hidden or 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
#!/bin/env python | |
import argparse | |
import yaml | |
parser = argparse.ArgumentParser() | |
parser.add_argument('old_template', type=open, help='The old NIC template') | |
ns = parser.parse_args() | |
data = yaml.load(ns.old_template.read()) | |
osnetcfgimpt = data['resources']['OsNetConfigImpl'] | |
osnetcfgimpt['type'] = 'OS::Heat::SoftwareConfig' | |
osnetcfgimpt['properties']['group'] = 'script' | |
old_config = osnetcfgimpt['properties']['config']['os_net_config']['network_config'] | |
osnetcfgimpt['properties']['config'] = { | |
'str_replace': { | |
'template': { | |
'get_file': '/usr/share/openstack-tripleo-heat-templates/network/scripts/run-os-net-config.sh'}, | |
'params': { | |
'$network_config': { | |
'network_config': old_config}}}} | |
print(yaml.dump(data, Dumper=yaml.CDumper)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment