Respect is_management_address for provider_networks

When generating inventory first check that is done, if user has defined
a container/management network. However, this logic ignores
is_management_address / is_container_address keys.
At the same time it expects another key - `address_prefix` which can or
should be set to `container` or `management`.

Change-Id: I49ebd1e0925a4b088b42bdf875b5f0b2dcc7eeae
This commit is contained in:
Dmitriy Rabotyagov 2024-04-06 16:00:57 +02:00 committed by Dmitriy Rabotyagov
parent 506d3bae49
commit ca2c366309

View File

@ -1170,8 +1170,11 @@ def main(config=None, check=False, debug=False, environment=None, **kwargs):
continue
q_name = p_net.get('ip_from_q')
if q_name and q_name in cidr_networks:
if (p_net.get('address_prefix') in ('container',
'management')):
addr_prefix = p_net.get('address_prefix')
is_mgmt = p_net.get(
'is_management_address', p_net.get('is_container_address')
)
if (addr_prefix in ('container', 'management') or is_mgmt):
if user_cidr is None:
user_cidr = []
user_cidr.append(cidr_networks[q_name])