From f423e93e0723f2ea2ad761ff073d239197e39ede Mon Sep 17 00:00:00 2001 From: Anat Wax Date: Tue, 12 Apr 2022 09:23:07 +0300 Subject: [PATCH] Enter validate_create and wait_for_interface_deleted if self.worker_pods --- .../node_network_configuration_policy.py | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ocp_resources/node_network_configuration_policy.py b/ocp_resources/node_network_configuration_policy.py index 4c5039ceaa..723b93db26 100644 --- a/ocp_resources/node_network_configuration_policy.py +++ b/ocp_resources/node_network_configuration_policy.py @@ -221,22 +221,24 @@ def clean_up(self): super().clean_up() def wait_for_interface_deleted(self): - for pod in self.worker_pods: - for iface in self.ifaces: - iface_name = iface["name"] - node_network_state = NodeNetworkState(name=pod.node.name) - iface_dict = node_network_state.get_interface(name=iface_name) - if iface_dict.get("type") == "ethernet": - LOGGER.info(f"{iface_name} is type ethernet, skipping.") - continue + if self.worker_pods: + for pod in self.worker_pods: + for iface in self.ifaces: + iface_name = iface["name"] + node_network_state = NodeNetworkState(name=pod.node.name) + iface_dict = node_network_state.get_interface(name=iface_name) + if iface_dict.get("type") == "ethernet": + LOGGER.info(f"{iface_name} is type ethernet, skipping.") + continue - node_network_state.wait_until_deleted(name=iface_name) + node_network_state.wait_until_deleted(name=iface_name) def validate_create(self): - for pod in self.worker_pods: - for bridge in self.ifaces: - node_network_state = NodeNetworkState(name=pod.node.name) - node_network_state.wait_until_up(name=bridge["name"]) + if self.worker_pods: + for pod in self.worker_pods: + for bridge in self.ifaces: + node_network_state = NodeNetworkState(name=pod.node.name) + node_network_state.wait_until_up(name=bridge["name"]) def _ipv4_state_backup(self): # Backup current state of dhcp for the interfaces which arent veth or current bridge