add stable-status field to deliverable files

Allow deliverables to set a stable-status value that may differ from
the series setting.

Story: #2001852
Change-Id: If5d54c317b9e1c7bc858d05bc41950eee98684fc
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-04-20 11:43:12 -04:00
parent 92e2de953e
commit 1fa2a5bdb8
3 changed files with 88 additions and 0 deletions

View File

@ -530,6 +530,16 @@ class Deliverable(object):
self._series_status_data = series_status.SeriesStatus.default()
return self._series_status_data[self.series]
@property
def stable_status(self):
status = self._data.get('stable-status')
if status is None:
if self.is_independent:
status = 'development'
else:
status = self.series_info.status
return status
def __eq__(self, other):
return self.name == other.name

View File

@ -97,3 +97,11 @@ properties:
- type: "object"
required: ["name", "location"]
additionalProperties: False
stable-status:
type: "string"
enum:
- development
- maintained
- extended maintenance
- unmaintained
- end of life

View File

@ -0,0 +1,70 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import textwrap
import fixtures
from oslotest import base
from openstack_releases import deliverable
from openstack_releases import series_status
from openstack_releases import yamlutils
class TestStableStatus(base.BaseTestCase):
_series_status_data = yamlutils.loads(textwrap.dedent('''
- name: rocky
status: development
initial-release: 2018-08-30
- name: queens
status: maintained
initial-release: 2018-02-28
- name: ocata
status: extended maintenance
initial-release: 2017-02-22
- name: newton
status: end of life
initial-release: 2016-10-06
eol-date: 2017-10-25
'''))
def setUp(self):
super().setUp()
self.series_status = series_status.SeriesStatus(
self._series_status_data)
self.useFixture(fixtures.MockPatch(
'openstack_releases.deliverable.Deliverable._series_status_data',
self.series_status,
))
def test_default_to_series(self):
d = deliverable.Deliverable(
team='team',
series='ocata',
name='name',
data={},
)
self.assertEqual('extended maintenance', d.stable_status)
def test_override_series(self):
d = deliverable.Deliverable(
team='team',
series='newton',
name='name',
data={
'stable-status': 'extended maintenance',
},
)
self.assertEqual('extended maintenance', d.stable_status)