From 1e52c4c2956c1578b369026be58d674edcbef092 Mon Sep 17 00:00:00 2001 From: Andy Lake Date: Fri, 21 Jun 2024 10:03:40 -0400 Subject: [PATCH] Fix for validate_refs that says hosts are not valid if they are an empty object --- .../perfsonar-psconfig/psconfig/client/psconfig/base_node.py | 4 +++- .../perfsonar-psconfig/psconfig/client/psconfig/config.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/psconfig/perfsonar-psconfig/psconfig/client/psconfig/base_node.py b/psconfig/perfsonar-psconfig/psconfig/client/psconfig/base_node.py index 05cf362b..116011c6 100644 --- a/psconfig/perfsonar-psconfig/psconfig/client/psconfig/base_node.py +++ b/psconfig/perfsonar-psconfig/psconfig/client/psconfig/base_node.py @@ -718,7 +718,9 @@ def _validate_urlhostport(self, val=None): return False def _has_field(self, parent, field): - return parent.get(field) + if parent.get(field) is None: + return False + return True def _init_field(self, parent, field): if not self._has_field(parent, field): diff --git a/psconfig/perfsonar-psconfig/psconfig/client/psconfig/config.py b/psconfig/perfsonar-psconfig/psconfig/client/psconfig/config.py index 69b743af..24ddc290 100644 --- a/psconfig/perfsonar-psconfig/psconfig/client/psconfig/config.py +++ b/psconfig/perfsonar-psconfig/psconfig/client/psconfig/config.py @@ -252,7 +252,7 @@ def validate_refs(self): host_ref = address.host_ref() context_refs = address.context_refs() #check host ref - if host_ref and not self.host(host_ref): + if host_ref and self.host(host_ref) is None: ref_errors.append("Address {} references a host object {} that does not exist.".format(addr_name, host_ref)) #check context refs