Skip to content

Commit 36b3541

Browse files
authored
Merge pull request #113 from Beauline/main
fix: prevent crash when labels or selector are None or not dict
2 parents ebb44a0 + f723202 commit 36b3541

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

library/integration_library_builtIn/PlatformLibrary.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import ssl
1516
import time
1617
from typing import List
1718

1819
import kubernetes
1920
import urllib3
20-
import ssl
2121
import yaml
2222
from deprecated import deprecated
2323
from kubernetes import client, config
@@ -828,6 +828,10 @@ def get_pod_names_for_deployment_entity(self, deployment_entity_name: str, names
828828

829829
@staticmethod
830830
def _do_labels_satisfy_selector(labels: dict, selector: dict):
831+
if selector is None or not isinstance(selector, dict):
832+
return False
833+
if labels is None or not isinstance(labels, dict):
834+
return False
831835
selector_pairs = list(selector.items())
832836
label_pairs = list(labels.items())
833837
if len(selector_pairs) > len(label_pairs):

0 commit comments

Comments
 (0)