From c9d0e5c3f29bac10a1830747a9a139d8b0b4b188 Mon Sep 17 00:00:00 2001 From: Zac Petterd Date: Fri, 2 Mar 2018 12:04:38 +1100 Subject: [PATCH 1/2] Fixes a bug when running fix_serialization on Kubernetes ExternalName service definitions --- openshift/helper/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openshift/helper/base.py b/openshift/helper/base.py index c10551e0..9c2cbe1b 100644 --- a/openshift/helper/base.py +++ b/openshift/helper/base.py @@ -175,7 +175,7 @@ def has_method(self, method_action): return method is not None def fix_serialization(self, obj): - if obj and obj.kind == "Service": + if obj and obj.kind == "Service" and obj.spec.type != "ExternalName": for port in obj.spec.ports: try: port.target_port = int(port.target_port) From 7d54947cc08016d3a657ce8352c920634693d1a2 Mon Sep 17 00:00:00 2001 From: Zac Petterd Date: Mon, 5 Mar 2018 09:02:16 +1100 Subject: [PATCH 2/2] Simply check if ports array is defined --- openshift/helper/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openshift/helper/base.py b/openshift/helper/base.py index 9c2cbe1b..1fe5ca3f 100644 --- a/openshift/helper/base.py +++ b/openshift/helper/base.py @@ -175,7 +175,7 @@ def has_method(self, method_action): return method is not None def fix_serialization(self, obj): - if obj and obj.kind == "Service" and obj.spec.type != "ExternalName": + if obj and obj.kind == "Service" and obj.spec.ports: for port in obj.spec.ports: try: port.target_port = int(port.target_port)