Check for both config.yaml/config.json

We changed the format of network config generated from json
to yaml when we moved to use ansible for network configuration.
This resulted in _validate_no_ip_change() preflight validation
being useless when net_config_override is not used.

Change-Id: I1a2a6b817b32bc5c95cd4810dc3cca43366d717a
This commit is contained in:
rabi 2022-04-12 08:26:30 +05:30
parent a0dd1801e1
commit dfed2b1921

View File

@ -296,10 +296,13 @@ def _validate_no_ip_change():
if CONF.net_config_override:
os_net_config_file = CONF.net_config_override
else:
os_net_config_file = '/etc/os-net-config/config.json'
# Nothing to do if we haven't already installed
os_net_config_file = '/etc/os-net-config/config.yaml'
if not os.path.isfile(
os.path.expanduser(os_net_config_file)):
os_net_config_file = '/etc/os-net-config/config.json'
# Nothing to do if we haven't already installed
if not os.path.isfile(os.path.expanduser(os_net_config_file)):
return
try:
with open(os_net_config_file, 'r') as f: