Fix preflight validation

When using net-config-override, objects can exist without a 'name' key.
The validation fails with KeyError: 'name'. This change only considers
objects with 'name' key present.

Change-Id: I77a30b13e4459ed3dae64a23b128433639eec5b4
This commit is contained in:
Mihai Plasoianu 2020-05-18 11:24:52 +02:00 committed by Sergii Golovatiuk
parent 5db8184186
commit 1362b900f9
1 changed files with 2 additions and 1 deletions

View File

@ -311,7 +311,8 @@ def _validate_no_ip_change():
with open(os_net_config_file) as f:
network_config = json.loads(f.read())
ctlplane = [i for i in network_config.get('network_config', [])
if i['name'] == 'br-ctlplane'][0]
if i.get('name') == 'br-ctlplane'][0]
except ValueError:
# File was empty
return