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 <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-07-10 16:54:20 -04:00
parent f8aa29c8a8
commit d3f7e4e1f5
2 changed files with 13 additions and 2 deletions

View File

@ -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']

View File

@ -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):