Merge "make net_config_override of undercloud.conf work with yaml" into stable/ussuri

This commit is contained in:
Zuul 2021-12-21 21:29:32 +00:00 committed by Gerrit Code Review
commit 8500140388
2 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ class StandaloneConfig(BaseConfig):
help=_( help=_(
'Path to network config override template. ' 'Path to network config override template. '
'Relative paths get computed inside of $HOME. ' 'Relative paths get computed inside of $HOME. '
'Must be in the json format. ' 'Must be in the json or yaml format. '
'Its content overrides anything in t-h-t ' 'Its content overrides anything in t-h-t '
'<role>NetConfigOverride. The processed ' '<role>NetConfigOverride. The processed '
'template is then passed in Heat via the ' 'template is then passed in Heat via the '

View File

@ -15,12 +15,12 @@
"""Plugin action implementation""" """Plugin action implementation"""
import json
import logging import logging
import netaddr import netaddr
import os import os
import shutil import shutil
import sys import sys
import yaml
from cryptography import x509 from cryptography import x509
@ -794,9 +794,9 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=True,
os.path.split(data_file)[-1]).render(context).replace( os.path.split(data_file)[-1]).render(context).replace(
"'", '"').replace('&quot;', '"') "'", '"').replace('&quot;', '"')
try: try:
net_config_json = json.loads(net_config_str) net_config_json = yaml.safe_load(net_config_str)
except ValueError: except ValueError:
net_config_json = json.loads("{%s}" % net_config_str) net_config_json = yaml.safe_load("{%s}" % net_config_str)
if 'network_config' not in net_config_json: if 'network_config' not in net_config_json:
msg = ('Unsupported data format in net_config_override ' msg = ('Unsupported data format in net_config_override '