Browse Source

Merge "Net attr: Sort segments without name attribute first" into stable/ussuri

changes/46/788146/1
Zuul 4 weeks ago
committed by Gerrit Code Review
parent
commit
3a25fe770b
2 changed files with 22 additions and 1 deletions
  1. +6
    -1
      heat/engine/resources/openstack/neutron/net.py
  2. +16
    -0
      releasenotes/notes/os-neutron-net-segments-attribute-semi-predictable-b40a869317d053cc.yaml

+ 6
- 1
heat/engine/resources/openstack/neutron/net.py View File

@ -284,8 +284,13 @@ class Net(neutron.NeutronResource):
if self.resource_id is None:
return
if name == self.SEGMENTS:
return [segment.to_dict() for segment in list(self.client(
segments = [segment.to_dict() for segment in list(self.client(
'openstack').network.segments(network_id=self.resource_id))]
# Sort segments without name attribute first.
# See bug: https://bugs.launchpad.net/tripleo/+bug/1894920
segments.sort(key=lambda s: s['name'] is not None)
return segments
attributes = self._show_resource()
return attributes[name]


+ 16
- 0
releasenotes/notes/os-neutron-net-segments-attribute-semi-predictable-b40a869317d053cc.yaml View File

@ -0,0 +1,16 @@
---
fixes:
- |
The ordering in the list of segments returned by ``OS::Neutron::Net``
resources is not predictable. Stack updates changeing attributes
of the network can cause the list of segments to shift.
The ordering is now slightly more predictable, segments with name=``None``
are now placed first in the list. This doesn't guarantee the order, but
typically only the segment implicitly created by neutron has no name
attribute set. The template author should ensure other segments on the
network does have a name set, so that the implicit segment will always be
index 0. Resolving attributes of the implcitly created segment on the
network resource can then predictibly happen using index 0. See `bug:
1894920 <https://bugs.launchpad.net/tripleo/+bug/1894920>`_.

Loading…
Cancel
Save