Skip to content

Commit 2e26163

Browse files
committed
Call to_dict only if not self.res
1 parent 35bba24 commit 2e26163

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ocp_resources/node_network_configuration_policy.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ def add_interface(
177177
set_ipv6=True,
178178
ipv6_enable=False,
179179
):
180-
self.res = self.to_dict()
180+
# If self.res is already defined (from to_dict()), don't call it again.
181+
if not self.res:
182+
self.res = self.to_dict()
183+
181184
self.res.setdefault("spec", {}).setdefault("desiredState", {})
182185
if not iface:
183186
iface = {
@@ -284,8 +287,8 @@ def clean_up(self):
284287
self._absent_interface()
285288
self.wait_for_status_success()
286289
self.wait_for_interface_deleted()
287-
except Exception as e:
288-
LOGGER.error(e)
290+
except Exception as exp:
291+
LOGGER.error(exp)
289292

290293
self.delete()
291294

0 commit comments

Comments
 (0)