From 8a54b26fd721e85bfcdf3dca781ff26fe787a466 Mon Sep 17 00:00:00 2001 From: mprahl Date: Mon, 6 Aug 2018 19:42:37 -0400 Subject: [PATCH] Expose the NVR of component builds in the API to help future debugging --- README.rst | 2 ++ module_build_service/models.py | 1 + tests/test_views/test_views.py | 3 +++ 3 files changed, 6 insertions(+) diff --git a/README.rst b/README.rst index bc973d4f..0d5b217f 100644 --- a/README.rst +++ b/README.rst @@ -559,6 +559,7 @@ about the referenced component build. "format": "rpms", "id": 854, "module_build": 42, + "nvr": "pth-1-1", "package": "pth", "state": 1, "state_name": "COMPLETE", @@ -571,6 +572,7 @@ The response includes: - ``id`` - the ID of the component build. - ``format`` - typically "rpms". +- ``nvr`` - the NVR of the component build. - ``package`` - the package name. - ``state`` - the numerical state of the component build. - ``state_name`` - the named component build state and can be "COMPLETE", diff --git a/module_build_service/models.py b/module_build_service/models.py index d0e8f01b..a6342b8b 100644 --- a/module_build_service/models.py +++ b/module_build_service/models.py @@ -721,6 +721,7 @@ class ComponentBuild(MBSBase): 'state': self.state, 'state_reason': self.state_reason, 'module_build': self.module_id, + 'nvr': self.nvr } try: diff --git a/tests/test_views/test_views.py b/tests/test_views/test_views.py index 72f79769..06a5937e 100644 --- a/tests/test_views/test_views.py +++ b/tests/test_views/test_views.py @@ -444,6 +444,7 @@ class TestViews: assert data['id'] == 1 assert data['format'] == 'rpms' assert data['module_build'] == 2 + assert data['nvr'] == 'nginx-1.10.1-2.module+2+b8661ee4' assert data['package'] == 'nginx' assert data['state'] == 1 assert data['state_name'] == 'COMPLETE' @@ -456,6 +457,7 @@ class TestViews: assert data['id'] == 1 assert data['format'] == 'rpms' assert data['module_build'] == 2 + assert data['nvr'] == 'nginx-1.10.1-2.module+2+b8661ee4' assert data['package'] == 'nginx' assert data['state'] == 1 assert data['state_name'] == 'COMPLETE' @@ -468,6 +470,7 @@ class TestViews: assert data['id'] == 3 assert data['format'] == 'rpms' assert data['module_build'] == 3 + assert data['nvr'] == 'postgresql-9.5.3-4.module+3+0557c87d' assert data['package'] == 'postgresql' assert data['state'] == 1 assert data['state_name'] == 'COMPLETE'