Simplify the test
@@ -97,8 +97,8 @@ class ActionNodesPods(ActionAbstract):
def dont_self_destruct(self, items):
""" Don't kill its own pod or node """
- HOST_IP = os.environ.get("HOST_IP", "")
- POD_NAME = os.environ.get("POD_NAME", os.environ.get("HOSTNAME", ""))
+ HOST_IP = os.environ.get("HOST_IP")
+ POD_NAME = os.environ.get("POD_NAME", os.environ.get("HOSTNAME"))
attrs = dict(
ip=HOST_IP,
extIp=HOST_IP,
@@ -107,7 +107,7 @@ class ActionNodesPods(ActionAbstract):
matches = set()
for item in items:
for attr, val in attrs.items():
- if getattr(item, attr, None) == val:
+ if val and getattr(item, attr, None) == val:
matches.add(item)
return [
item
