From bd45a745da1ef95718a5a6893f510ef02937f1b5 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Thu, 16 Dec 2021 10:22:17 +1300 Subject: [PATCH] Don't assume json network config in validations Change I5f5cec5a1622be4983b4d0db392453d1c489fa40 allowed the net_config_override file to be yaml as well as json, but if enable_validations is true the _validate_no_ip_change assumes the network config is json. This change loads this file as yaml in _validate_no_ip_change. Change-Id: Iaeadf412865c059d252ffc7087db3853569b74ee Related-Bug: #1927090 (cherry picked from commit f8ee246464c387a9733de3f0ea245d523098e42a) --- tripleoclient/v1/undercloud_preflight.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tripleoclient/v1/undercloud_preflight.py b/tripleoclient/v1/undercloud_preflight.py index 153db6f1c..0416ee753 100644 --- a/tripleoclient/v1/undercloud_preflight.py +++ b/tripleoclient/v1/undercloud_preflight.py @@ -12,13 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -import json import logging import netaddr import netifaces import os import subprocess import sys +import yaml from osc_lib.i18n import _ @@ -303,8 +303,8 @@ def _validate_no_ip_change(): os.path.expanduser(os_net_config_file)): return try: - with open(os_net_config_file) as f: - network_config = json.loads(f.read()) + with open(os_net_config_file, 'r') as f: + network_config = yaml.safe_load(f) ctlplane = [i for i in network_config.get('network_config', []) if i['name'] == 'br-ctlplane'][0] except ValueError: