Add a node_region field to the job metadata

The node region can be figured out from the build_node very easily and
having a discrete field will make filtering to a single region much
simpler. This commit adds a new metadata field 'node_region' which is
the cloud region that the build_node ran in.

Change-Id: I06bbb62d21871ee61dbfb911143efff376992b98
This commit is contained in:
Matthew Treinish 2015-11-19 18:57:45 -05:00
parent 48500b4462
commit 17e2e0946c
1 changed files with 6 additions and 0 deletions

View File

@ -126,6 +126,12 @@ class EventProcessor(threading.Thread):
elif parameters.get("ZUUL_NEWREV"):
fields["build_newrev"] = parameters.get("ZUUL_NEWREV",
"UNKNOWN")
if ["build_node"] != "UNKNOWN":
node_region = '-'.join(
fields["build_node"].split('-')[-3:-1])
fields["node_region"] = node_region or "UNKNOWN"
else:
fields["node_region"] = "UNKNOWN"
return fields
def _parse_event(self, event, fileopts):