Send debugging info about this program to Zuul
This will make sure that correct data appear in the output of `zuul show
running-jobs`.
Change-Id: If8a57e89cb23645ad7cc17f408c3b57253ccc945
diff --git a/turbo_hipster/lib/models.py b/turbo_hipster/lib/models.py
index c96a075..08e0755 100644
--- a/turbo_hipster/lib/models.py
+++ b/turbo_hipster/lib/models.py
@@ -17,6 +17,8 @@
import json
import logging
import os
+import pkg_resources
+import socket
from turbo_hipster.lib import common
from turbo_hipster.lib import utils
@@ -83,12 +85,25 @@
def _get_work_data(self):
if self.work_data is None:
hostname = os.uname()[1]
+ fqdn = socket.getfqdn()
self.work_data = dict(
name=self.job_name,
number=self.job.unique,
manager='turbo-hipster-manager-%s' % hostname,
url='http://localhost',
+ worker_hostname=hostname,
+ worker_fqdn=fqdn,
+ worker_program='turbo-hipster',
)
+ try:
+ self.work_data['worker_version'] = (
+ pkg_resources.get_distribution('turbo_hipster').version
+ )
+ except pkg_resources.DistributionNotFound:
+ # Package isn't installed; I do not think that manually
+ # attempting to extract version in some ad-hoc manner would be
+ # worth it -> just ignore this.
+ pass
return self.work_data
def _send_work_data(self):