Skip to content

Commit cb9aae5

Browse files
committed
BGPVPN: Fix resource comparison
This patch updates the resource comparison to accurately differentiate between the manipulation of networks, ports, and router associations. Introduced in I84fe4bb45d24c2f4a7a0246e2b9fb50354a715e0, the previous implementation contained incorrect variable names, leading to inconsistent results. This fix ensures that each resource type is properly identified during comparison. Closes-Bug: #2064286 Change-Id: Ieb87174296240f8f76ec10b39007935545b1bd3f
1 parent fb8de78 commit cb9aae5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

neutronclient/osc/v2/networking_bgpvpn/resource_association.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def take_action(self, parsed_args):
7575
body.update(
7676
arg2body(bgpvpn['id'], parsed_args))
7777

78-
if self._assoc_res_name == constants.NETWORK_ASSOC:
78+
if self._resource == constants.NETWORK_ASSOC:
7979
obj = client.create_bgpvpn_network_association(
8080
bgpvpn['id'], **body)
81-
elif self._assoc_res_name == constants.PORT_ASSOCS:
81+
elif self._resource == constants.PORT_ASSOC:
8282
obj = client.create_bgpvpn_port_association(bgpvpn['id'], **body)
8383
else:
8484
obj = client.create_bgpvpn_router_association(
@@ -123,10 +123,10 @@ def take_action(self, parsed_args):
123123
arg2body = getattr(self, '_args2body', None)
124124
if callable(arg2body):
125125
body = arg2body(bgpvpn['id'], parsed_args)
126-
if self._assoc_res_name == constants.NETWORK_ASSOC:
126+
if self._resource == constants.NETWORK_ASSOC:
127127
client.update_bgpvpn_network_association(
128128
bgpvpn['id'], parsed_args.resource_association_id, **body)
129-
elif self._assoc_res_name == constants.PORT_ASSOCS:
129+
elif self._resource == constants.PORT_ASSOC:
130130
client.update_bgpvpn_port_association(
131131
bgpvpn['id'], parsed_args.resource_association_id, **body)
132132
else:
@@ -165,9 +165,9 @@ def take_action(self, parsed_args):
165165
fails = 0
166166
for id in parsed_args.resource_association_ids:
167167
try:
168-
if self._assoc_res_name == constants.NETWORK_ASSOC:
168+
if self._resource == constants.NETWORK_ASSOC:
169169
client.delete_bgpvpn_network_association(bgpvpn['id'], id)
170-
elif self._assoc_res_name == constants.PORT_ASSOCS:
170+
elif self._resource == constants.PORT_ASSOC:
171171
client.delete_bgpvpn_port_association(bgpvpn['id'], id)
172172
else:
173173
client.delete_bgpvpn_router_association(bgpvpn['id'], id)
@@ -221,10 +221,10 @@ def take_action(self, parsed_args):
221221
params = {}
222222
if parsed_args.property:
223223
params.update(parsed_args.property)
224-
if self._assoc_res_name == constants.NETWORK_ASSOC:
224+
if self._resource == constants.NETWORK_ASSOC:
225225
objs = client.bgpvpn_network_associations(
226226
bgpvpn['id'], retrieve_all=True, **params)
227-
elif self._assoc_res_name == constants.PORT_ASSOCS:
227+
elif self._resource == constants.PORT_ASSOC:
228228
objs = client.bgpvpn_port_associations(
229229
bgpvpn['id'], retrieve_all=True, **params)
230230
else:
@@ -265,10 +265,10 @@ def get_parser(self, prog_name):
265265
def take_action(self, parsed_args):
266266
client = self.app.client_manager.network
267267
bgpvpn = client.find_bgpvpn(parsed_args.bgpvpn)
268-
if self._assoc_res_name == constants.NETWORK_ASSOC:
268+
if self._resource == constants.NETWORK_ASSOC:
269269
obj = client.get_bgpvpn_network_association(
270270
bgpvpn['id'], parsed_args.resource_association_id)
271-
elif self._assoc_res_name == constants.PORT_ASSOCS:
271+
elif self._resource == constants.PORT_ASSOC:
272272
obj = client.get_bgpvpn_port_association(
273273
bgpvpn['id'], parsed_args.resource_association_id)
274274
else:

0 commit comments

Comments
 (0)