OpenStack IRC meetings schedule
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

70 lines
2.2 KiB

  1. #!/usr/bin/env python
  2. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  3. # not use this file except in compliance with the License. You may obtain
  4. # a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software
  9. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  10. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  11. # License for the specific language governing permissions and limitations
  12. # under the License.
  13. from __future__ import print_function
  14. import argparse
  15. import requests
  16. import yaml
  17. from yaml2ical import meeting
  18. ACCESSBOT_YAML_URL = ('http://git.openstack.org/cgit/'
  19. 'openstack-infra/project-config/'
  20. 'plain/accessbot/channels.yaml')
  21. # FIXME*tonyb): Extend this to ensure the channel has a meetbot.
  22. # Right now this is true as the meetbots are in the globals but it could
  23. # change.
  24. def get_channels():
  25. req = requests.get(ACCESSBOT_YAML_URL)
  26. if req.status_code != 200:
  27. raise SystemError('Unable to retrieve accessbot config. Aborting!')
  28. accessbot = yaml.safe_load(req.text)
  29. return set([x['name'] for x in accessbot['channels']])
  30. def main():
  31. # build option parser:
  32. description = """
  33. A tool that checks if the IRC channel happens in is capable of running a
  34. fully functional MeetBot.
  35. """
  36. parser = argparse.ArgumentParser(
  37. formatter_class=argparse.RawDescriptionHelpFormatter,
  38. description=description)
  39. parser.add_argument("-y", "--yamldir",
  40. dest="yaml_dir",
  41. required=True,
  42. help="directory containing YAML to process")
  43. args = parser.parse_args()
  44. channels = get_channels()
  45. meetings = meeting.load_meetings(args.yaml_dir)
  46. for m in meetings:
  47. for s in m.schedules:
  48. if s.freq == 'adhoc':
  49. continue
  50. if s.irc not in channels:
  51. raise ValueError(("%s: IRC channel: %s not in (%s)") %
  52. (s.filefrom, s.irc,
  53. ', '.join(channels)))
  54. if __name__ == '__main__':
  55. main()