From d3f7e4e1f5c860072a5da070f06498c0ad0aa160 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 10 Jul 2018 16:54:20 -0400 Subject: [PATCH] fix series name handling in new-release The independent series has to be treated as a special case because it does not appear in the sequence of normal series. Not everything in the deliverables directory is actually a series name, so we need to use the series status data to get the list of valid names. Change-Id: Iea9ce55bf3c99afc7bcdd74cc0b7eb523c0a922d Signed-off-by: Doug Hellmann --- openstack_releases/cmds/new_release.py | 10 ++++++++-- openstack_releases/series_status.py | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/openstack_releases/cmds/new_release.py b/openstack_releases/cmds/new_release.py index b4120f5a48..455741589d 100644 --- a/openstack_releases/cmds/new_release.py +++ b/openstack_releases/cmds/new_release.py @@ -21,6 +21,7 @@ import shutil import tempfile from openstack_releases import gitutils +from openstack_releases import series_status from openstack_releases import yamlutils # Release models that support release candidates. @@ -111,9 +112,14 @@ def get_release_history(series, deliverable): Returns an array of arrays containing the releases for each series, in reverse chronological order starting from specified series. """ - all_series = sorted(os.listdir('deliverables'), reverse=True) + if series == '_independent': + included_series = ['_independent'] + else: + status = series_status.SeriesStatus.default() + all_series = reversed(status.names) + included_series = all_series[all_series.index(series):-1] release_history = [] - for current_series in all_series[all_series.index(series):-1]: + for current_series in included_series: try: deliv_info = get_deliverable_data(current_series, deliverable) releases = deliv_info['releases'] diff --git a/openstack_releases/series_status.py b/openstack_releases/series_status.py index c2a0e84b1a..0b758b4f4b 100644 --- a/openstack_releases/series_status.py +++ b/openstack_releases/series_status.py @@ -86,6 +86,11 @@ class SeriesStatus(collections.abc.Mapping): } return organized + @property + def names(self): + for entry in self._raw_data: + yield entry['name'] + # Mapping API def __len__(self):