update validation rule to look at series status on deliverable

Update the validation rule that prevents new releases on closed series
to look at the stable status of the deliverable, which can override
the value for the series.

Change-Id: I4beffa646253da7f50ddb1054b90839d881e3aa5
Story: #2001852
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-04-20 11:50:18 -04:00
parent a817e3a6ab
commit 8cda10dc82
3 changed files with 11 additions and 11 deletions

View File

@ -879,13 +879,13 @@ def validate_new_releases_at_end(deliv, context):
def validate_new_releases_in_open_series(deliv, context):
"New releases may only be added to open series."
if deliv.series_info.allows_releases:
print('{} has status {!r} and allows releases'.format(
deliv.series, deliv.series_info.status))
if deliv.allows_releases:
print('{} has status {!r} for {} and allows releases'.format(
deliv.name, deliv.series, deliv.stable_status))
return
LOG.debug('%s has status %r and will not allow releases',
deliv.series, deliv.series_info.status)
LOG.debug('%s has status %r for %s and will not allow new releases',
deliv.name, deliv.stable_status, deliv.series)
# Remember which entries are new so we can verify that they
# appear at the end of the file.
@ -912,9 +912,9 @@ def validate_new_releases_in_open_series(deliv, context):
if new_releases:
# The series is closed but there is a new release.
msg = ('series {} has status {!r} '
msg = ('deliverable {} has status {!r} for {}'
'and cannot have new releases tagged').format(
deliv.series, deliv.series_info.status)
deliv.name, deliv.stable_status, deliv.series)
context.error(msg)
else:
print('OK')

View File

@ -547,6 +547,10 @@ class Deliverable(object):
status = self.series_info.status
return status
@property
def allows_releases(self):
return self.stable_status in ('development', 'maintained')
def __eq__(self, other):
return self.name == other.name

View File

@ -47,10 +47,6 @@ class Series(object):
def eol_date(self):
return self._data.get('eol-date', None)
@property
def allows_releases(self):
return self.status in ('development', 'maintained')
class SeriesStatus(collections.abc.Mapping):