fix(trunk): Always add relevant sub_ports

This fixes two similar issues:
1. sub_ports weren't added when initially creating the trunk
2. sub_ports identified by ID instead of name weren't added

Closes-Bug: #2089589
Change-Id: I1342e23aafdd44eaf16f236d6d07ace41ae1d247
Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
This commit is contained in:
Jan-Philipp Litza
2025-12-15 10:02:24 +01:00
parent a178493281
commit af4d72a3bb
2 changed files with 66 additions and 7 deletions

View File

@@ -201,6 +201,11 @@ class TrunkModule(OpenStackModule):
if state == 'present' and not trunk:
# create trunk
trunk = self._create(name_or_id, port)
# add sub ports
update = self._build_update(trunk, sub_ports)
trunk = self._update(trunk, update)
self.exit_json(changed=True,
trunk=trunk.to_dict(computed=False))
elif state == 'present' and trunk:
@@ -232,7 +237,7 @@ class TrunkModule(OpenStackModule):
if found is False:
psp = self.params['sub_ports'] or []
for k in psp:
if sp['name'] == k['port']:
if sp['name'] == k['port'] or sp['id'] == k['port']:
spobj = {
'port_id': sp['id'],
'segmentation_type': k['segmentation_type'],