From e11e4e89d22f290411d144fc0111e18065cea1d1 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 26 Oct 2017 15:59:21 -0400 Subject: [PATCH] make it easier to map deliverable type to release type Change-Id: I0cb1a87efeca1fb44878501ac1cbd6f72da7f688 Signed-off-by: Doug Hellmann --- openstack_releases/cmds/validate.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/openstack_releases/cmds/validate.py b/openstack_releases/cmds/validate.py index 611dbfb515..a612e9686f 100644 --- a/openstack_releases/cmds/validate.py +++ b/openstack_releases/cmds/validate.py @@ -348,6 +348,13 @@ def validate_gitreview(deliverable_info, workdir, mk_warning, mk_error): mk_error('%s has no .gitreview file' % (project['repo'],)) +_TYPE_TO_RELEASE_TYPE = { + 'library': 'python-pypi', + 'service': 'python-service', + 'horizon-plugin': 'horizon', +} + + def get_release_type(deliverable_info, project, workdir): """Return tuple with release type and boolean indicating whether it was explicitly set. @@ -356,11 +363,9 @@ def get_release_type(deliverable_info, project, workdir): if 'release-type' in deliverable_info: return (deliverable_info['release-type'], True) - if deliverable_info.get('type') == 'library': - return ('python-pypi', False) - - if deliverable_info.get('type') == 'service': - return ('python-service', False) + from_type = _TYPE_TO_RELEASE_TYPE.get(deliverable_info.get('type')) + if from_type is not None: + return (from_type, False) if deliverable_info.get('include-pypi-link', False): return ('python-pypi', False)