Fix hostvars logstash job submission error

The log server may have just been added to the inventory; we're
really interested in the node the job ran on, so make sure that
the node we grab is a nodepool node.

Change-Id: I3f228f9a0c913476f946f546cdd5a2d56864c549
This commit is contained in:
James E. Blair
2017-09-14 17:00:22 -06:00
parent 5ef48fa65f
commit efa6e0a2ba

View File

@@ -99,14 +99,14 @@ class LogMatcher(object):
return out_event
def makeFields(self, filename):
hosts = self.hosts
hosts = [h for h in self.hosts.values() if 'nodepool' in h]
zuul = self.zuul
fields = {}
fields["filename"] = filename
fields["build_name"] = zuul['job']
fields["build_status"] = self.success and 'SUCCESS' or 'FAILURE'
# TODO: this is too simplistic for zuul v3 multinode jobs
node = list(hosts.values())[0]
node = hosts[0]
fields["build_node"] = node['nodepool']['label']
# TODO: should be build_executor, or removed completely
fields["build_master"] = zuul['executor']['hostname']