Support StoryBoard project names in place of IDs

Now that storyboard-webclient no longer displays the project id
number in project URLs by default, it is harder for people to look
them up without referring to the API. Conversely, we could just use
the newer name-based project query support in the API instead. As a
transitional step, support both. Also switch openstack-infra/shade
from id to name to prove that the validate tool change is effective.

Change-Id: I9da97a1af40bb3527c1c7e8a66a267c76b9db564
This commit is contained in:
Jeremy Stanley 2018-09-08 01:46:40 +00:00
parent df9f6ed897
commit b84749b4e2
5 changed files with 12 additions and 7 deletions

View File

@ -1,7 +1,7 @@
---
include-pypi-link: yes
release-model: cycle-with-intermediary
storyboard: 760
storyboard: openstack-infra/shade
team: OpenStackSDK
type: library
repository-settings:

View File

@ -454,7 +454,10 @@ def validate_bugtracker(deliv, context):
'Could not verify storyboard project, API call failed.'
)
for project in projects_resp.json():
if sb_id == project.get('id'):
# TODO(fungi): This can be changed to simply check
# that sb_id == project.get('name') later if all the
# data gets updated from numbers to names.
if sb_id in (project.get('id'), project.get('name')):
break
else:
context.error(

View File

@ -437,8 +437,7 @@ class Deliverable(object):
@property
def storyboard_id(self):
sb_id = self._data.get('storyboard')
return int(sb_id) if sb_id else None
return self._data.get('storyboard')
@property
def repos(self):

View File

@ -16,7 +16,10 @@ properties:
launchpad:
type: "string"
storyboard:
type: "integer"
# TODO(fungi): Previously this was an integer but now we
# want to support strings. This can be changed to "string"
# later if all the data gets updated from numbers to names.
type: ["integer", "string"]
release-notes:
oneOf:
- type: "string"

View File

@ -225,7 +225,7 @@ class TestValidateBugTracker(base.BaseTestCase):
"updated_at": None,
"autocreate_branches": False,
"repo_url": None,
"id": 760,
"id": "openstack-infra/shade",
"description": "Client library for OpenStack...",
}
]
@ -234,7 +234,7 @@ class TestValidateBugTracker(base.BaseTestCase):
team='team',
series=defaults.RELEASE,
name='name',
data={'storyboard': '760'},
data={'storyboard': 'openstack-infra/shade'},
),
self.ctx,
)