Update channel list from project-config

Now that the governance resolution to allow teams to host meetings in
their channels [1] has merged and all defined channels have a meetbot[2]
get the valid channel list from infra's canonical source.

[1] I631e2597bf818c5e4b2f813da14764d2cb55d0ce
[2] I6a8a1cedd8a83e3e856e8df4aba4d0a584912eb0

Change-Id: I09e4fc07c486905a55ef06604b05493532175bf5
This commit is contained in:
Tony Breeds 2017-09-21 14:05:18 -04:00
parent 1ed5e1531a
commit abb4fd75c9

View File

@ -15,11 +15,25 @@
from __future__ import print_function
import argparse
import requests
import yaml
from yaml2ical import meeting
channels = set(['openstack-meeting', 'openstack-meeting-alt',
'openstack-meeting-3', 'openstack-meeting-4',
'openstack-meeting-5', 'openstack-meeting-cp'])
ACCESSBOT_YAML_URL = ('http://git.openstack.org/cgit/'
'openstack-infra/project-config/'
'plain/accessbot/channels.yaml')
# FIXME*tonyb): Extend this to ensure the channel has a meetbot.
# Right now this is true as the meetbots are in the globals but it could
# change.
def get_channels():
req = requests.get(ACCESSBOT_YAML_URL)
if req.status_code != 200:
raise SystemError('Unable to retrieve accessbot config. Aborting!')
accessbot = yaml.safe_load(req.text)
return set([x['name'] for x in accessbot['channels']])
def main():
@ -39,6 +53,7 @@ fully functional MeetBot.
help="directory containing YAML to process")
args = parser.parse_args()
channels = get_channels()
meetings = meeting.load_meetings(args.yaml_dir)
for m in meetings:
for s in m.schedules:
@ -49,5 +64,6 @@ fully functional MeetBot.
(s.filefrom, s.irc,
', '.join(channels)))
if __name__ == '__main__':
main()