Don't assume 'dhcp' if node_network_data set
If ipv4_address is not set, the current logic in inventory.py sets the addressing_mode to dhcp which prevents network_data.json being generated. This means that even if node_network_data is set which overrides ipv4_address, you have to set it anyway to ensure that your node_network_data gets written to the file. This patch fixes the logic such that only if both of ipv4_address and node_network_data are not set, then it assumes addressing_mode=dhcp. Change-Id: Iab8e0a8422d9f33c8c5b1362bdaefabf6f39d52e Closes-Bug: #1656335
This commit is contained in:
parent
c7adb13973
commit
b70ef9eae8
@ -179,8 +179,9 @@ def _process_baremetal_data(data_source, groups, hostvars):
|
||||
for name in file_data:
|
||||
host = file_data[name]
|
||||
# Perform basic validation
|
||||
if ('ipv4_address' not in host or
|
||||
not host['ipv4_address']):
|
||||
node_net_data = host.get('node_network_data')
|
||||
ipv4_addr = host.get('ipv4_address')
|
||||
if not node_net_data and not ipv4_addr:
|
||||
host['addressing_mode'] = "dhcp"
|
||||
else:
|
||||
host['ansible_ssh_host'] = host['ipv4_address']
|
||||
|
Loading…
Reference in New Issue
Block a user