Commit Graph

61 Commits

Author SHA1 Message Date
Clark Boylan 9e9f9fa108 Move statusbot to python3.11 and Bookworm
Time for our semi annual update to the base OS and python version. The
motivation here is that OpenDev would like to drop bullseye image builds
and older python image builds. Needs things to move off the old stuff
first.

Change-Id: I9156ef39ce8541dc77e08a4094dec1368bb02dc7
2023-09-19 10:39:04 -07:00
Clark Boylan 1885469fb0 Revert "Move statusbot to quay.io"
This reverts commit d5b2eb868f.

OpenDev is moving back to docker.io to preserve speculative container
image testing.

Change-Id: Ic1be6566d1c4c2ae78662c1a3b8cdd7620ec77c5
2023-05-24 13:38:58 -07:00
Clark Boylan d5b2eb868f Move statusbot to quay.io
This moves statusbot image publication to quay.io. We also update the
source of our base python images to quay.io.

Depends-On: https://review.opendev.org/c/opendev/system-config/+/881932
Change-Id: Ie5b49b917a1406266c198072d2cfd7b1529abb3d
2023-05-05 16:24:17 -07:00
Ian Wienand a973d8572b
Update ancient hacking version
This version should work with modern python.  Fix up a few minor
formatting things it picks up.

Change-Id: Ie9bebfa5eacc53aa8cbc857c48c7b71c55141864
2022-11-16 14:36:31 +11:00
Ian Wienand 37fb799a1e
Don't recurse on log() message
Both of these classes have a function called log(), so making the
logger "log" is not what we want ... it leads to a debug log sending
out toots ...

Rename the logger variable

Change-Id: I00007daa4763bd05a8f600369d1c65726f3831a6
2022-11-16 13:08:21 +11:00
Ian Wienand 0263b3abda
Add mastodon support
Add very simple mastodon support.  Basically send a request with a
bearer token.

Change-Id: I345dfa5d68a5cbf4035db85be9883592f143dd93
2022-11-16 08:27:22 +11:00
Clark Boylan a0760a8025 Update container images to python3.10
Do this so to take advantage of faster python3.10. This will also allow
us to drop 3.8 image builds making room for python 3.11.

Change-Id: I7f013a6616f98fe22420da68166eb15b6b7b7bdc
2022-10-14 14:39:23 -07:00
Zuul 387e31a16c Merge "Handle exception for unprivileged commands" 2022-09-28 14:15:37 +00:00
Ian Wienand 5cc27bd9ee twitter: ensure we have a space after the status icon
Change-Id: Ic0acd0f2f1587b51dc35148dad833ce9608e6553
2022-07-14 10:26:59 +10:00
Ian Wienand a269bac966 twitter: Fix typo on OK tick
fe0 is the "variation selector", 0xf is "VS16" which ensures the
preceeding character is shown as a graphical emoji.  The tick here had
a typo from I2746b291a0bc451f1a8dc3aec46adfddb10bb938.

Change-Id: I6c9146c84712e9bdd888babb23049059bb5f8fc8
2022-06-20 09:42:27 +10:00
Ian Wienand 3563ac69a2 Don't inline code emojis
Use the codepoints directly; also add the VS16 selector where required
which ensures we get the graphical version, which is what we want
here.

Change-Id: I2746b291a0bc451f1a8dc3aec46adfddb10bb938
2022-04-20 11:00:04 +10:00
Ian Wienand 14f3df569f Prefix twitter logs with emoji
- ⚠️ Alert
- 📌 Notice
- 🪵 Log
-  OK

Although self explainitory, we can put this key in the description
page too.

Change-Id: Ieaafc625477e100029c9c7cd86cb4cf8cfa49963
2022-04-20 09:37:21 +10:00
Ian Wienand 0428e0d9cb twitter: send log level messages
We note interesting things we're doing a log level, so sending it to
twitter, where we have about 375 people who were engaged enough to
follow us, seems like a way to increase visibility with what is going
on in the project.

Change-Id: I59189d71fb6a3618b14947033d8cc0bf70d8d0b1
2022-04-08 15:14:19 +10:00
Ian Wienand 8097c54a2e twitter: use better variable for the tweet chain link
Using "last" can also imply "final", "prior" is more helpful

Change-Id: Ie601373ec6441dd90bc4447359a50c20663639df
2022-04-06 11:20:51 +10:00
Ian Wienand 0b290dc863 twitter: catch update exceptions
We don't need to kill the whole bot if tweets fail, just log it.

Change-Id: Id874fd6b46f0ef48b1f6fef707672fa467e1c268
2022-04-06 11:04:53 +10:00
Ian Wienand a2bf4189e7 twitter: switch to tweepy
python-twitter has stopped working after Twitter upstream removed an
endpoint it was querying.  Switch to the better maintained tweepy,
which is basically the same.

tweepy doesn't automatically split tweets, so implement that.  Split
tweets will now be in reply to each other, which is a feature.

Change-Id: Id40af0e314ce8a6cb542f6138f5deaa8a587b260
2022-04-06 10:46:12 +10:00
Ian Wienand 067bc37ec0 Revert "Add use_ssl option"
This broke the OpenDev connection, we should figure out why

This reverts commit 4c31332e23.

Change-Id: I944b1a5e8dcb451374ad07c2f34ba873cc9b11ca
2021-11-12 14:50:16 +11:00
Tristan Cacqueray 52bf62acc6 Handle exception for unprivileged commands
This change prevents the bot from crashing on unprivileged commands.

Change-Id: Ib855550aaccfdaca6b8997611de19603ecff72e2
2021-11-10 19:59:18 +00:00
Tristan Cacqueray 4c31332e23 Add use_ssl option
This change enables using the statusbot with a non ssl server.

Change-Id: I4e79625316ebaa391941743bfd1a2ea29e14df09
2021-11-10 19:59:03 +00:00
Tristan Cacqueray 42e3cc433d Add Etherpad backend
Change-Id: Ia525ed337ac7569bec54b70bf57a6c010c33f801
2021-11-10 19:26:59 +00:00
Tristan Cacqueray 0edde4fccc Introduce a BackendInterface
This change replaces object inheritance with object composition to
enable adding backend other than WikiPage.

Change-Id: Id1a5453a1635f17c67594696d58e1d5c17b9566f
2021-11-10 19:26:37 +00:00
Jeremy Stanley 2ce45fe35d More Py3K fixes, urrlib.quote->urllib.parse.quote
We're running statusbot under Python 3 now, and urllib.quote no
longer exists there. Use urllib.parse.quote instead.

Change-Id: If9b7eced5c65bc3a3e0a078c338da2a609af0fc2
2021-06-25 20:39:40 +00:00
Ian Wienand 16dfaad342 Dockerfile: correct config command line
Change-Id: Idce184019daf407424f657e1ca024782c635cf6e
2021-06-09 14:28:38 +10:00
Ian Wienand 6da21b9499 Add container image build
Change-Id: Ic3f685cce211cd10bb392c372da4c1517d036afa
2021-06-09 10:56:57 +10:00
Jeremy Stanley e8f9ee6e45 Switch to Python3
Our servers have, in the two years since we last needed to change
statusbot, switched to installing packages with pip for Python 3.x
instead of 2.7. Instead of figuring out how to unfurl that, just
roll forward and embrace the glorious pastfuture.

Update the simplemediawiki version to pull in a prerelease, since
that's the only way to get a version which supports Py3K.

Change-Id: I24100ad2e9d87e20b7fd9ce90399346846529985
2021-05-30 00:44:35 +00:00
Clark Boylan e13ba0ca77 Add non SASL auth back to statusbot
Some networks don't support SASL and we want to support those networks.
This adds non SASL auth back to this IRC bot.

Note that networks like OFTC don't support identity-msg cap extensions.
For this reason we also remove the cap checking for authenticated nicks
in this bot. Instead we will rely on nick enforcement by nickserv.

Change-Id: I81381398b4c100990c04f454191cee52568dbdfe
2021-05-29 09:40:07 -07:00
OpenDev Sysadmins 0d29658781 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:25:36 +00:00
Jeremy Stanley 79e285e53a Identify with SASL
Identify through SASL using the convenient ib3 mixins, and
get rid of a bunch of special-case code in the process.

This helps when dealing with channels set to require identified
users, as otherwise channel joins will race NickServ's processing of
the identify message and some channels will end up not serviced by
the bot (an alternative would be to delay joining channels until the
identify success is confirmed, but the implementation for that looks
like it would be at least as complex).

Note this also effectively drops non-SSL IRC support. Given
passwords are sent over this connection, I don't see it as a loss.

Change-Id: I0aa15d81f0158fcf2b74825cdb3968d62356fa1d
Co-Authored-By: Thierry Carrez <thierry@openstack.org>
Depends-On: https://review.openstack.org/599061
2018-08-31 20:07:33 +00:00
Mohammed Naser 7b3a04a575 Bump python-twitter to 3.4
The latest release of python-twitter adds support for 280 character
tweets which will make the status updates much cleaner looking
in timelines.

Change-Id: I24b0e45ac69e65a803b4392e54327a0c1f21351f
2018-02-19 10:33:40 -05:00
Zuul 375ed10dce Merge "Thanks & Success bot provide confirmation site url" 2018-01-25 16:30:23 +00:00
Mike Perez 009093c4ae Thanks & Success bot provide confirmation site url
In confirmation of giving a thanks or success post, this will output the
wiki url so the user knows where it got posted.

Change-Id: I06d637c00dccbee49ad8a60398ac21af4064034e
2018-01-04 08:27:16 -08:00
Thierry Carrez 177fe62586 Fix continuation character under Python 2
Recent Twitter messages show the characters \u2026 at the end of
messages needing continuation, rather than the corresponding
character (…), due to statusbot running under Python 2.

Use u\u2026 instead, si that it works in both Python 2 and Python 3.

Change-Id: I958be50bef1991edf0b3aeaf5aa1a32a48f03ef6
2017-12-12 17:58:07 +01:00
Monty Taylor d01cfd3994
Let the python-twitter library handle message splitting
Twitter auto-converts urls to twitter shortened URLs. This can affect
the math for message splitting. The python-twitter library has this
implemented already, including all of the logic necessary ... so just
use it.

The character '\u2026' is the unicode horizontal ellipsis and is used
to indicate that the message is continued.

Change-Id: I5492a2792f5d11dccbe4a3454396262341449eab
2017-09-18 19:45:47 -05:00
Mike Perez 4316cbfadd Implement #thanks command in statusbot
Add simple unprivileged "#thanks" command that adds thanks snippets to
a celebration wiki page.

NB: this adds a couple of configuration options, but fails gracefully if
they are not present.

Change-Id: I995c3189f0f109df35c56b63b3e19427f60f3750
2017-08-01 16:25:57 -07:00
Andreas Jaeger 57d6ed9ad7 Make example config file consistent
Update the sample config file to use _key as well for the
access_token_key - like all other entries.

Change-Id: I8e561a3827bed72601babcb021d12b0a8ec8cad0
2016-09-20 14:52:55 +02:00
Andreas Jaeger 15b3e12ad4 Fix twitter support
statusbot failed to start with error that access_token did not exist.
The variable is called access_token_key, use it.

Change-Id: Ib45a1021046145ff5a65f5aaa2e276558762a2a9
2016-09-20 14:42:21 +02:00
Jenkins a0d518a16f Merge "Explicitly handle ImportError for pid_file_module" 2016-09-09 20:39:11 +00:00
Jenkins c9796fc86f Merge "Explicitly catch Exception" 2016-09-09 20:28:18 +00:00
Paul Belanger 37e88bbdb3
Update requirements
This fixes some issues with pyflakes:

  AttributeError: 'ClassDef' object has no attribute 'keywords'

Add requirements for six>=1.7.0

This is for jaraco.collections but something is draging in an older version.

Change-Id: I4733fb4be29463ae6dbfef1ecfb80b0aa8b45e5c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-05-27 19:23:22 -04:00
Joshua Hesketh d95fe85dc4 Post message to twitter on 'ok' status
Change-Id: I0c92f52eca7670fa86a1803fd3fb4b01f46f9bc4
2016-01-04 03:14:14 +00:00
Monty Taylor b9ea2612f7 Add twitter support to statusbot
Similar to replicating to github for the convenience of our
developer community, sending statuses ALSO to twitter seems
like a potentially low-impact way to communicate status on
an additional channel.

Change-Id: Ib4bdbb335e4bc12d75d5f0ec2a1b95c8a6b2e7d5
2015-12-30 10:38:59 -06:00
Monty Taylor e46fe612e7 Update to pbr-based build
Change-Id: I4f7e669563b537eb40365eb006ee327b10784783
2015-12-30 10:27:05 -06:00
Andreas Jaeger 65e67bfb1c Use git.openstack.org everywhere
Our official git master is at git.openstack.org, update places
that use github instead.

Change-Id: If52141d186da8202bb9491f71b2eeb06c95de5fe
2015-12-29 21:25:51 +01:00
Dolph Mathews 1299a815f5 Explicitly catch Exception
This allows non-Exceptions like KeyboardInterrupt, etc, to be ignored
and raised naturally.

Change-Id: I58b3d46d90d7a98891d0afb481da4df60dd9ce62
2015-10-12 19:26:01 +00:00
Dolph Mathews 6ba0de29a5 Explicitly handle ImportError for pid_file_module
Change-Id: Ide9f386a1819b5111d54a75231ff996179f43ecb
2015-10-12 19:24:17 +00:00
Thierry Carrez d58d5456c7 Implement #success command in statusbot
Add simple unprivileged "#success" command that adds small
success snippets to a celebration wiki page.

NB: this adds a couple of configuration options, but fails
gracefully if they are not present.

Change-Id: Ib113fa2b55e47759003a84850c0c85a2f883814e
2015-09-08 16:19:28 +02:00
Thierry Carrez 5a27f181ac Add abstractions to make room for #success
Abstract common WikiPage functions to a parent class to make room
for SuccessPage operations. Make handle_commands specific to #status
commands.

Change-Id: I887ab9b81326bcf4543ff7d8cc6a03eb31691e34
2015-09-08 15:51:44 +02:00
James E. Blair efe7f1cf1b Send broadcast messages with notice command
If the bot has +v or +o, it bypasses target change rate limits.

Also, it stands out more in most clients.

Change-Id: I1dc7dcb4cbfc8ab6ce70d1e34720a2753cf36a96
2014-04-25 11:33:09 -07:00
James E. Blair e75f59cdb6 Sleep longer
2 seconds is the closest thing to a recommendation I can find.
With 1 second we were hitting errors about changing targets too
often.

Change-Id: Ieb36d3c156bc9e2e36bd8bb85a438cdfed661046
2014-04-15 17:03:24 -07:00
James E. Blair 832d196be7 Sleep 1 second
Apparently 0.5 seconds isn't slow enough to avoid services flood
protection.

Change-Id: I79a05e08dc6c5ca7a44f4e7dd93738732b2bed7d
2014-03-12 10:05:30 -07:00