Add role path to JSON result in callback plugin

Having the role path is sometimes needed for debugging in case there are
multiple roles with the same name.

Change-Id: Icbd682a6cd84f2bcbaf07625f601316ffd2ea4fc
This commit is contained in:
Simon Westphahl 2018-10-02 08:34:17 +02:00
parent 3dba813c64
commit 5def8720dc
2 changed files with 5 additions and 1 deletions

View File

@ -94,6 +94,9 @@ class TestZuulJSON(AnsibleZuulTestCase):
role_name = json_result[0]['plays'][0]['tasks'][0]['role']['name']
self.assertEqual('json-role', role_name)
role_path = json_result[0]['plays'][0]['tasks'][0]['role']['path']
self.assertEqual('json-role', os.path.basename(role_path))
def test_json_time_log(self):
job = self._run_job('no-log')
with self.jobLog(job):

View File

@ -119,7 +119,8 @@ class CallbackModule(CallbackBase):
if task._role:
data['role'] = {
'name': task._role.get_name(),
'id': str(task._role._uuid)
'id': str(task._role._uuid),
'path': task._role._role_path,
}
return data