diff options
author | Chris Evich <cevich@redhat.com> | 2019-09-20 11:49:07 -0400 |
---|---|---|
committer | Chris Evich <cevich@redhat.com> | 2019-09-20 14:03:54 -0400 |
commit | 33b3d2914f1f8a76751ccd5aa873fc4e7b05f344 (patch) | |
tree | 87e2db9603ae6d8028a5692373ffecf94c1aa161 /contrib/cirrus/podbot.py | |
parent | 66f4bc76384cca8716f9192aa279138cb2b35812 (diff) | |
download | podman-33b3d2914f1f8a76751ccd5aa873fc4e7b05f344.tar.gz podman-33b3d2914f1f8a76751ccd5aa873fc4e7b05f344.tar.bz2 podman-33b3d2914f1f8a76751ccd5aa873fc4e7b05f344.zip |
Cirrus: More podbot/success improvements
* Fix one disused and two missing required env. vars.
* Slightly optomize processing of commit-author names
* Fix problem of printing duplicate author names when there are multiple
commits.
* Fix bot's IRC connection timeout too short.
* Add a single retry of IRC connection after 5-second delay.
Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'contrib/cirrus/podbot.py')
-rwxr-xr-x | contrib/cirrus/podbot.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/cirrus/podbot.py b/contrib/cirrus/podbot.py index 1be41a8ed..9ca4915a7 100755 --- a/contrib/cirrus/podbot.py +++ b/contrib/cirrus/podbot.py @@ -12,7 +12,7 @@ import sys class IRC: - response_timeout = 10 # seconds + response_timeout = 30 # seconds irc = socket.socket() def __init__(self, server, nickname, channel): @@ -90,9 +90,16 @@ class IRC: if len(sys.argv) < 3: print("Error: Must pass desired nick and message as parameters") else: - irc = IRC("irc.freenode.net", sys.argv[1], "#podman") - err = irc.connect(*os.environ.get('IRCID', 'Big Bug').split(" ", 2)) - if not err: + for try_again in (True,False): + irc = IRC("irc.freenode.net", sys.argv[1], "#podman") + err = irc.connect(*os.environ.get('IRCID', 'Big Bug').split(" ", 2)) + if err and try_again: + print("Trying again in 5 seconds...") + time.sleep(5) + continue + elif err: + break irc.message(" ".join(sys.argv[2:])) time.sleep(5.0) # avoid join/quit spam irc.quit() + break |