Ignore non host ports by tag filtering

Don't include tripleo_vip_net and tripleo_service_vip
ports when generating the inventory.

Closes-Bug: #1928469
Change-Id: I3db93dd6aa493da6f1c059b1c49eb0fa0f3179fc
This commit is contained in:
Harald Jensås 2021-05-19 15:53:03 +02:00
parent bac04330bb
commit 0a35f94522
1 changed files with 5 additions and 0 deletions

View File

@ -129,6 +129,7 @@ class NeutronData(object):
def _ports_by_role_and_host(self):
mandatory_tags = {'tripleo_role'}
ignore_tags = {'tripleo_vip_net', 'tripleo_service_vip'}
ports_by_role_and_host = {}
for port in self.ports:
@ -137,6 +138,10 @@ class NeutronData(object):
continue
tags = self._tags_to_dict(port.tags)
# Ignore non host ports by looking for the tags
if ignore_tags.intersection(tags):
continue
# In case of missing required tags, raise an error.
# neutron is useless as a inventory source in this case.
if not mandatory_tags.issubset(tags):