Merge "Cleanup the remaining osf repos and their data"

This commit is contained in:
Zuul 2020-08-02 18:19:10 +00:00 committed by Gerrit Code Review
commit 4baafe6abe
3 changed files with 6 additions and 76 deletions

View File

@ -12,7 +12,6 @@
"""Work with the governance repository."""
import collections
import logging
import os.path
import weakref
@ -98,13 +97,11 @@ class Governance(object):
_projects_filename = 'reference/projects.yaml'
_tc_repos_filename = 'reference/technical-committee-repos.yaml'
_sigs_repos_filename = 'reference/sigs-repos.yaml'
_wgs_repos_filename = 'reference/foundation-board-repos.yaml'
def __init__(self, team_data, tc_data, sigs_data, wgs_data):
def __init__(self, team_data, tc_data, sigs_data):
self._team_data = team_data
self._tc_data = tc_data
self._sigs_data = sigs_data
self._wgs_data = wgs_data
team_data['Technical Committee'] = {
'deliverables': {
@ -119,35 +116,9 @@ class Governance(object):
for repo in sig_info
}
}
for wg_name, wg_info in wgs_data.items():
team_data[wg_name] = {
'deliverables': {
repo['repo'].partition('/')[-1]: {'repos': [repo['repo']]}
for repo in wg_info
}
}
self._teams = [Team(n, i) for n, i in self._team_data.items()]
@classmethod
def _fixup_wgs_data(cls, wgs_data):
# For some period of time reference/foundation-board-repos.yaml
# was the wrong data structure. Each WG should be a list of dict()s
# where each dict has a single key 'repo' and a str() value.
# The incorrect format is a list of dict()s with a single key 'repo'
# but the value is a list of strings.
# Transform the incorrect format into the correct one so callers don't
# notice.
for wg_name in list(wgs_data.keys()):
wg_info = wgs_data[wg_name]
_tmp = []
for idx in range(len(wg_info)):
if isinstance(wg_info[idx].get('repo', ''), list):
for repo in wg_info[idx]['repo']:
_tmp.append(collections.OrderedDict(repo=repo))
if _tmp:
wgs_data[wg_name] = _tmp
@classmethod
def from_local_repo(cls, repo_dir='.'):
team_filename = os.path.join(repo_dir, cls._projects_filename)
@ -159,11 +130,7 @@ class Governance(object):
sigs_filename = os.path.join(repo_dir, cls._sigs_repos_filename)
sigs_data = _yamlutils.load_from_file(sigs_filename)
wgs_filename = os.path.join(repo_dir, cls._wgs_repos_filename)
wgs_data = _yamlutils.load_from_file(wgs_filename)
cls._fixup_wgs_data(wgs_data)
return cls(team_data, tc_data, sigs_data, wgs_data)
return cls(team_data, tc_data, sigs_data)
@classmethod
def from_remote_repo(cls, repo_url_base=REPO_URL_BASE, gittag=None):
@ -185,13 +152,7 @@ class Governance(object):
r = requests.get(sigs_url, params=query_options)
sigs_data = _yamlutils.loads(r.text)
wgs_url = REPO_URL_BASE + '/reference/foundation-board-repos.yaml'
LOG.debug('fetching WGs data from %s', wgs_url)
r = requests.get(wgs_url, params=query_options)
wgs_data = _yamlutils.loads(r.text)
cls._fixup_wgs_data(wgs_data)
return cls(team_data, tc_data, sigs_data, wgs_data)
return cls(team_data, tc_data, sigs_data)
def get_team(self, name):
for team in self._teams:

View File

@ -76,27 +76,16 @@ api:
- repo: openstack/api-sig
"""
_wgs_data_yaml = """
---
# List of repositories owned by Foundation board and subcommittes
Interop Working Group:
- repo: openstack/interop
- repo: openstack/refstack-client
- repo: openstack/refstack
- repo: openstack/python-tempestconf
"""
TEAM_DATA = _yamlutils.loads(_team_data_yaml)
TC_DATA = _yamlutils.loads(_tc_data_yaml)
SIGS_DATA = _yamlutils.loads(_sigs_data_yaml)
WGS_DATA = _yamlutils.loads(_wgs_data_yaml)
class TestGetRepoOwner(base.BaseTestCase):
def setUp(self):
super().setUp()
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA, WGS_DATA)
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA)
def test_repo_exists(self):
owner = self.gov.get_repo_owner(
@ -133,7 +122,7 @@ class TestGetRepositories(base.BaseTestCase):
def setUp(self):
super().setUp()
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA, WGS_DATA)
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA)
def test_by_team(self):
repos = self.gov.get_repositories(
@ -202,7 +191,7 @@ class TestGetTeam(base.BaseTestCase):
def setUp(self):
super().setUp()
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA, WGS_DATA)
self.gov = governance.Governance(TEAM_DATA, TC_DATA, SIGS_DATA)
def test_found(self):
team = self.gov.get_team('meta SIG')
@ -237,19 +226,3 @@ class TestTeamProperties(base.BaseTestCase):
def test_mission(self):
self.assertEqual('mission statement', self.team_with.mission)
self.assertIsNone(self.team_without.mission)
class TestFixupWGData(base.BaseTestCase):
def test_incorrect_format(self):
_wgs_data = _yamlutils.loads("""
---
# List of repositories owned by Foundation board and subcommittes
Interop Working Group:
- repo:
- openstack/interop
- openstack/refstack-client
- openstack/refstack
- openstack/python-tempestconf
""")
governance.Governance._fixup_wgs_data(_wgs_data)
self.assertEqual(WGS_DATA, _wgs_data)

View File

@ -1,4 +0,0 @@
---
# List of repositories owned by Foundation board and subcommittes
Transparency subcommittee:
- repo: openstack/transparency-policy