diff --git a/tools/check_channels.py b/tools/check_channels.py index a3cb1026..8607343d 100755 --- a/tools/check_channels.py +++ b/tools/check_channels.py @@ -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()