Fix exception for port extensions

This patch guards against exceptions when the group-based-policy
extension driver is called to augment a port resource, but the port
doesn't yet have a binding.

Change-Id: I6e220c8f9d919089c570b6e00055e083fd1d856d
This commit is contained in:
Thomas Bachman 2024-03-04 21:22:49 +00:00
parent f9bbb4786e
commit 2004000625
1 changed files with 2 additions and 1 deletions

View File

@ -1365,7 +1365,8 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
aim_resources.extend(resources)
binding = (port_db.port_bindings[0]
if port_db.port_bindings else None)
acc_name = self._get_acc_bundle_for_host(aim_ctx, binding.host)
acc_name = (self._get_acc_bundle_for_host(aim_ctx, binding.host) if
binding else None)
if resources and acc_name:
acc_bundle = aim_resource.InfraAccBundleGroup(name=acc_name)
aim_resources.append(acc_bundle)