Add first pass of main file elasticRecheck.py

Currently monitors gerrit stream only.
This commit is contained in:
Joe Gordon 2013-09-12 17:19:16 -07:00
parent 1f20b9df5c
commit 1d101e3cd8
2 changed files with 33 additions and 0 deletions

2
elasticRecheck.conf Normal file
View File

@ -0,0 +1,2 @@
[gerrit]
user=jogo

31
elasticRecheck.py Normal file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env python
import ConfigParser
import sys
import gerritlib
def is_failed_tempest(event):
if event.get('type', '') != 'comment-added':
return False
if event['author']['username'] == 'Jenkins':
return True
def main():
config = ConfigParser.ConfigParser()
config.read('elasticRecheck.conf')
host = 'review.openstack.org'
user = config.get('gerrit', 'user', 'jogo')
port = 29418
import gerritlib.gerrit
gerrit = gerritlib.gerrit.Gerrit(host, user, port)
gerrit.startWatching()
while True:
event = gerrit.getEvent()
if is_failed_tempest(event):
print event['comment']
if __name__ == "__main__":
main()