Merge "update validation rule to look at series status on deliverable"

This commit is contained in:
Zuul 2018-04-25 20:44:40 +00:00 committed by Gerrit Code Review
commit 1a9f7bb288
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):