From 1eaa535d1e14058d3cf5d6389f6bcaa0666acf22 Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Thu, 19 Nov 2015 12:06:31 +1100 Subject: [PATCH] Add check_channels.py and testenv to run it Create a new tool called check_channels.py that ensures that the irc channel is one which is capable of running a fully functional MeetBot *or* one that is an 'office hours' type event that doesn't use MeetBot. Also create a tox textenv to run it. Once this is clean we can add a gate job to run these checks and vote. Change-Id: I57a725b55fb611214d0f0eec08179aae01c1e49a --- tools/check_channels.py | 55 +++++++++++++++++++++++++++++++++++++++++ tox.ini | 4 +++ 2 files changed, 59 insertions(+) create mode 100755 tools/check_channels.py diff --git a/tools/check_channels.py b/tools/check_channels.py new file mode 100755 index 00000000..69efb296 --- /dev/null +++ b/tools/check_channels.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +# 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. + +from __future__ import print_function + +import argparse +from yaml2ical import meeting + +channels = set(['openstack-meeting', 'openstack-meeting-alt', + 'openstack-meeting-3', 'openstack-meeting-4', + 'openstack-meeting-cp', + # NOTE(tonyb)These channels are acceptable as they're for + # office hours rather than offical meetings and do not require + # MeetBot + 'openstack-community', 'openstack-neutron-release']) + + +def main(): + # build option parser: + description = """ +A tool that checks if the IRC channel happens in is capable of running a +fully functional MeetBot. +""" + + parser = argparse.ArgumentParser( + formatter_class=argparse.RawDescriptionHelpFormatter, + description=description) + + parser.add_argument("-y", "--yamldir", + dest="yaml_dir", + required=True, + help="directory containing YAML to process") + + args = parser.parse_args() + meetings = meeting.load_meetings(args.yaml_dir) + for m in meetings: + for s in m.schedules: + if s.irc not in channels: + raise ValueError(("%s: IRC channel: %s not in (%s)") % + (s.filefrom, s.irc, + ', '.join(channels))) + +if __name__ == '__main__': + main() diff --git a/tox.ini b/tox.ini index cdb9b9f1..4d837926 100644 --- a/tox.ini +++ b/tox.ini @@ -20,3 +20,7 @@ commands = -y meetings -o output/irc-meetings.ical \ -t meetingindex.jinja -w output/index.html -f yaml2ical -y meetings -i output/calendars/ -f + +[testenv:check] +commands = + python tools/check_channels.py -y meetings