Commit Graph

555 Commits

Author SHA1 Message Date
Waseem Daher 7b801cbdfe Special CUSTOMER4 API release.
After this commit, we built an API tarball and sent it to
CUSTOMER4, and then promptly reverted the commit so that
we could continue as we had been before.

(imported from commit 662519a79edd508e7c115b451a7ec6fbdf1fc0a4)
2013-03-15 00:27:16 -04:00
Waseem Daher 226378304c Ship all of our examples in the API update tarball.
(imported from commit 4162114707f69bcfb6ecea95d7bdf4c080b4b168)
2013-03-15 00:22:49 -04:00
Jessica McKellar 4cfd486e67 twitter-bot: Fix hyphen typo in usage string.
(imported from commit a0da133bead740f60553a868c286e9eae461e861)
2013-03-08 15:58:45 -05:00
Jessica McKellar 0dd94f9913 demos: add a Twitter search bot.
(imported from commit 00c0c7b59616473ab2aec2a24b41798f7c8af322)
2013-03-08 15:58:45 -05:00
Jessica McKellar bd2807d3b7 Move twitter-bot to api/demos/.
(imported from commit eb0a9466b9064f89322ab593134af0761caeea8a)
2013-03-08 15:58:45 -05:00
Tim Abbott a64dd5a712 api: Fix version number check.
This fixes Trac #790.

(imported from commit 4bc82ac52298308bdb7d068ed6eee740e211aa56)
2013-03-06 14:19:32 -05:00
Tim Abbott 3be748ad25 [manual] Bump API version to 0.1.4.
To incorporate the site parsing fix from a couple weeks ago.

Before deploying this to prod we need to run build-api-tarball and
deploy the code to humbughq.com as for usual API releases.

(imported from commit f6711f5cc07d174c30866029032a595ecee785a3)
2013-03-05 10:17:57 -05:00
Jessica McKellar ad71168f77 Add an example RSS bot that runs out of cron.
(imported from commit 81d7e010f6316dfbe0ce7b645a7b61dde2881483)
2013-02-22 17:00:42 -05:00
Jessica McKellar 7202c50271 Install the demos directory in /usr/local/share/ as well.
(imported from commit 7516e5318f9e30544f53703ead4bca60f2dd7828)
2013-02-22 17:00:42 -05:00
Keegan McAllister 56d183ea06 Remove lurk mode from web client and API examples
See #796.

(imported from commit e238ce571c3f30d8312b630df7048ad1d9cad6d2)
2013-02-21 15:11:10 -05:00
Keegan McAllister 75704ad1e8 Consistently use #!/usr/bin/env python
At Ksplice we used /usr/bin/python because we shipped dependencies as Debian /
Red Hat packages, which would be installed against the system Python.  We were
also very careful to use only Python 2.3 features so that even old system
Python would still work.

None of that is true at Humbug.  We expect users to install dependencies
themselves, so it's more likely that the Python in $PATH is correct.  On OS X
in particular, it's common to have five broken Python installs and there's no
expectation that /usr/bin/python is the right one.

The files which aren't marked executable are not interesting to run as scripts,
so we just remove the line there.  (In general it's common to have libraries
that can also be executed, to run test cases or whatever, but that's not the
case here.)

(imported from commit 437d4aee2c6e66601ad3334eefd50749cce2eca6)
2013-02-20 16:02:30 -05:00
Keegan McAllister 8f5031687c post-receive: Send a notification to @everyone on non-fastforward
(imported from commit 8fc232dbef4b9b87f30f0b68c6407c43fd8553ba)
2013-02-19 17:39:55 -05:00
Tim Abbott 3a2ece7496 api: Fix reading in default value for api/site.
(imported from commit 7e698015599aee4f7b9176381b2ef2d29f3836af)
2013-02-19 15:40:18 -05:00
Tim Abbott c73ec65a2f git integration: Fix handling of new/removed branches.
(imported from commit f87ba78dbc292a05d82aedc74a90de6cbefee3e2)
2013-02-19 15:40:18 -05:00
Tim Abbott 346d16c034 api: Fix need to manually update list of integrations.
(imported from commit 6842230f939483d32acb023ad38c53cb627df149)
2013-02-19 10:17:06 -05:00
Tim Abbott 8c2c65f718 [manual]: API: bump version to 0.1.3.
We need to run build-api-tarball and release it on prod when pushing
this commit to prod.

(imported from commit 09e86500d2d208b1972c87444b4c2d56faafc8e6)
2013-02-19 09:17:08 -05:00
Tim Abbott 4caafd66ce Rewrite git hook for distribution and document it.
(imported from commit c3238bc5b5e29727cddb43bc55ab418326226acd)
2013-02-19 09:17:06 -05:00
Tim Abbott f0be25ec9d [manual] Bump API version to 0.1.2.
Before pushing this to prod, we need to build the 0.1.2 API tarball
and deploy it to the appropriate place on our servers.

(imported from commit ec1a07b3cc2a3e360dac32823ff7cd9de9de1da2)
2013-02-14 17:50:00 -05:00
Tim Abbott 6e1842d5fa trac: Add owner to list of fields that notify by default.
(imported from commit 48084ff341e4cce6164bfbfde9105768303d185c)
2013-02-14 17:50:00 -05:00
Tim Abbott 63827c2301 Make the Nagios integration configurable, available, and documented.
(imported from commit 1208fc08ed366a892763c3b29b9aeafa90b29981)
2013-02-14 17:50:00 -05:00
Tim Abbott 61369c87ec Move trac integration to a subdirectory.
(imported from commit fea539e275a5c81d9fde7f66ef8396d77f8d8b6d)
2013-02-14 17:50:00 -05:00
Tim Abbott 4ed2ffb4ce api: Fix installation of example and integrations.
Previously we were installing data files to e.g. /usr/local/example
and /usr/local/integrations, which is really not OK.

(imported from commit 0efb50412f93efabfe55443d5cac57a8ebb9fe06)
2013-02-14 17:50:00 -05:00
Tim Abbott 2b12dbae9c api: Make site settable via configuration files.
This works much better for working with staging, since rather than
needing to tell each individual tool that you're using staging, you
just specify that along with your API (which at the moment implies
whether you should be using staging or prod).

(imported from commit c1de8e72c24f35ef2160bce5339a5f03c6e1da95)
2013-02-14 17:50:00 -05:00
Tim Abbott c213e3f147 humbug_trac: Make sure we import humbug_trac_config from cwd.
It doesn't matter for this script, but I worry the code will be
copy-pasted into other new plugins.

(imported from commit 0fe5280af5aa05a7efc3d146f1570f9a72c62027)
2013-02-14 17:50:00 -05:00
Tim Abbott bf52fcff8a humbug_trac: Make notifications for comments configurable.
(imported from commit 8eeea4051194d0038b039befd9b9a0ee4099a30c)
2013-02-14 11:14:48 -05:00
Tim Abbott 818bf4d6e9 humbug_trac: Make which field changes cause notifications customizable.
(imported from commit 91b138a0eaf3c3773752ae3a4c4599bd5c095497)
2013-02-13 16:30:30 -05:00
Tim Abbott be57fa8a76 Split out Trac plugin configuration (and de-duplicate the plugin).
(imported from commit aa3cd2c5a376315a463bf564ba57d751e36431d6)
2013-02-13 16:30:30 -05:00
Tim Abbott bedf1dd563 api: Make call_on_each_message restart if 'last' is too old.
This should fix the symptoms of the problem we've been having where a
few API clients using the MIT Zephyr mirroring system sometimes seem
to end up with a too-old value of last.

(imported from commit 9f2426fa6a7e8365e8d3443bfd2cce3238cc9510)
2013-02-13 08:14:09 -05:00
Zev Benjamin ae97854d17 Bump API version number for addition of integrations/ directory
(imported from commit c5990ef963b5e7b7919fdef9f461a75e82015113)
2013-02-12 16:11:20 -05:00
Jessica McKellar 73331f1e18 api: Add a list-members example script for the /get_members query.
(imported from commit 2fc213b746eb032b98d86f933ce69e7cbe9822d1)
2013-02-11 13:45:47 -05:00
Jessica McKellar 8bbb88fc29 api: Add get_members to the Python bindings.
(imported from commit 446453e0cd355f37876a2233bbfa024a96f3a6a8)
2013-02-11 13:45:46 -05:00
Waseem Daher 2660db7e18 api: Move integrations into their own subdirectory.
(imported from commit e1a64fbbc64e64e7a2c2fdda4cc9bc77ff3bc852)
2013-02-07 14:15:44 -05:00
Waseem Daher 8f573fac4c Simplify the Trac integration plugin options slightly.
(imported from commit 4588d70f4e7664a9ba85be7003e17d4e8f55a333)
2013-02-06 17:37:44 -05:00
Zev Benjamin b0b304e58b Add a copy of our Trac integration (with example constants) to the API examples
(imported from commit 4e7bfaf92842ae0bb24c28ae1187d83ca5c44b0e)
2013-02-06 11:45:43 -05:00
Luke Faraone 71e98baad4 We no longer require requests<<1
(imported from commit 2ddfca4f969a4f0cba3851c8123b1a3427f63509)
2013-02-05 16:35:45 -05:00
Luke Faraone 61d8183a71 Be more explicit as to where .humbugrc goes
(imported from commit 3e229d61ebfef64e29ca45cc57eca04ec207ae86)
2013-02-05 16:35:45 -05:00
Luke Faraone fc7b6e9fb0 Invert check for .json() vs .json in requests.
dd74cadb incorrectly used .json when it should have used .json(), and
vice-versa.

(imported from commit 2a1d0bbaece77e6765c430ddf3e8de5d987194ae)
2013-02-05 16:34:16 -05:00
Tim Abbott a5f2bec873 api: Fix running with requests 1.0.x.
I would prefer to be testing the attribute itself rather than the
version, but it's not easy to access without an actual request object,
and I'd prefer to compute this once-and-for-all on startup, rather
than on each request, since the latter just seems fragile.

(imported from commit dd74cadb1b2359faeb3e1b482faeee4003dfad77)
2013-02-05 16:08:46 -05:00
Jessica McKellar d30c8b857e Only include send_message-related examples in API release.
(imported from commit 058a121b4b3c6b2829396c3c7a1007656a9e09da)
2013-02-05 14:09:29 -05:00
Luke Faraone 8e0ed8eb07 Update README to document new layout and installation instructions.
(imported from commit ba4d8c4db31ef572b53f49b6792b926236bea553)
2013-02-01 15:52:28 -05:00
Luke Faraone 0e4f1b6d24 Basic setup.py script for API
Refer to the API version via an import.

(imported from commit ef28f4edc0d519b4c6a49ef414279685a3d38202)
2013-02-01 15:52:28 -05:00
Luke Faraone 57e0d37249 Move files around in the API.
Bots are not part of what we distribute, so put them in the repo root.

We also updated some of the bots to use relative path names.

(imported from commit 0471d863450712fd0cdb651f39f32e9041df52ba)
2013-02-01 15:52:28 -05:00
Leo Franchi 6e9b8d895c Add munin plugin for send-receive timing
(imported from commit e2ae0775379ce59ab43213e68ade4d3f88b578e6)
2013-01-31 13:02:57 -05:00
Leo Franchi 6e3e6f00bd Add a proof of concept polling twitter bot
(imported from commit ededca33bc74404075de343aad1ec3358f07fe92)
2013-01-31 13:02:29 -05:00
Leo Franchi 6a755c2126 Convert to []-style list comprehensions to quiet pyflakes
(imported from commit d81ec98552846d8af71394c7c530aadc53f77127)
2013-01-30 15:24:49 -05:00
Luke Faraone 6b9f688ba4 Require requests version to be >= 0.12.1.
My previous commit (fbdc092029bbafea716e27fbb99fec58a6f24392)
incorrectly specified that you must have a version of python-requests
greater than 0.12.1, when it should be a >= relation since 0.12.1 is
sufficient.

(imported from commit 9f716af6dfe0ce17d982fc22d507f144e9543bec)
2013-01-17 13:54:41 -05:00
Luke Faraone ca8c759bef Document more specific dependency for humbug API on python-requests
(imported from commit fbdc092029bbafea716e27fbb99fec58a6f24392)
2013-01-16 16:57:38 -05:00
Luke Faraone 4463f267b3 Move the API into a subdirectory for ease of imports.
Previously, if users of our code put the API folder in their pyshared
they would have to import it as "humbug.humbug". By moving Humbug's API
into a directory named "humbug" and moving the API into __init__, you
can just "import humbug".

(imported from commit 1d2654ae57f8ecbbfe76559de267ec4889708ee8)
2013-01-16 16:55:22 -05:00
Luke Faraone e2429199ad Switch humbug-send to use "humbug" as the module.
The old-style api.humbug is deprecated, so we rewrite the path for things
to work correctly.

(imported from commit 360282b70fab1ad9d9d517157fc4fe06f9acd6a2)
2013-01-16 16:55:22 -05:00
Keegan McAllister 6ddbcf4799 gcal-bot: Handle all-day events
(imported from commit 7395f2cdd2003b24ce59a1dbdf6f6ae24b6eae6c)
2013-01-16 15:23:36 -05:00
Reid Barton 3c1f08c394 Add --stream option to print-messages, print-next-message API examples
(imported from commit aeaf8a111759de59ba87fc7014be86bd13810271)
2013-01-16 14:19:05 -05:00
Tim Abbott 5601086575 populate_db: Remove obsolete mit_subs_list.
(imported from commit 601cde1ae95d3e262be8444ded48f1fdca489f7b)
2013-01-08 17:23:22 -05:00
Jessica McKellar 5cf5bcaed5 Add logging for the feedback bot.
(imported from commit 4beb3ec69330baf0305ff0509900a5039145f4f4)
2013-01-08 10:53:33 -05:00
Tim Abbott f039623f2c zmirror: Fix running on 32 bit systems.
(This also needs pyzephyr to be compiled for 32 bit).

(imported from commit 06e33e17be517483213d402dd75ec2ac168395d1)
2013-01-02 14:20:24 -05:00
Tim Abbott bc2a5bad0b zephyr_mirror: Use modern default_format that discourages displaying it.
(imported from commit bfb2ffbf4ca7d424ffe54c4b2752378f4854db25)
2013-01-02 14:10:21 -05:00
Tim Abbott 429daf3c44 zmirror: Fix use of print rather than logging.foo in send_zephyr.
(imported from commit 7188f5364a864f2f144fb630d7a8c85d69219c42)
2013-01-02 14:10:21 -05:00
Tim Abbott ce3d0d3491 zmirror: Add another Zephyr class we can't subscribe to.
(imported from commit 6d43c901ecfd01574149efc06c782a49c5d64c9e)
2013-01-02 14:10:21 -05:00
Tim Abbott 7b35e72df4 zmirror: Use shorter default_format string.
This was causing about 10% of the time, personals being forwarded by
tabbott/extra@ATHENA.MIT.EDU to get this error:

zwrite: Field too long for buffer while sending notice to
tabbott/extra@ATHENA.MIT.EDU

We don't fully understand the cause of the problem, but this fixes it.

(imported from commit 22c39a1061cde9ad6973ef07aee7227623a3d47d)
2013-01-02 14:10:21 -05:00
Tim Abbott efd13505e1 zmirror: Attempt to receive zephyrs as we send them.
Sometimes the very first message we send isn't received by
python-zephyr; this could be because of our growing a 17-message queue
of zephyrs to service, so let's not do that.

(imported from commit 281bf1807442b6335b05c803b1a47e0a162bef4e)
2013-01-02 14:10:21 -05:00
Tim Abbott 08e1dda50f zmirror: Fix buggy retries on subscribe failures.
(imported from commit 786cb63be5aa5889283a4cbbecafe58690ad4ac9)
2013-01-02 14:10:18 -05:00
Tim Abbott 06cc9bad6c send-nagios-notification: Use a codeblock rather than a block quote.
This ensures that Humbug receives the verbatim text of the Nagios
body, rather than a slightly modified version.  Tested by running
manually.

(imported from commit 7e0eea0b230fd8c5552860acfb7372099598f036)
2013-01-02 10:24:35 -05:00
Tim Abbott 54bdd6fa45 zmirror: Fix printing of list of stream failures.
(imported from commit 0d573b412809263dbbacdf1b475adac440dae352)
2013-01-02 10:22:08 -05:00
Tim Abbott 927b0d7e44 zephyr_mirror: Cancel Zephyr subscriptions on graceful restart.
(imported from commit 39737bbf7ea76181ab25a0eaacf230906cba3d87)
2012-12-21 12:44:19 -05:00
Tim Abbott 5a8220ff2c zephyr_mirror: Fix killing duplicate zephyr_mirror processes.
The refactoring that we did a couple weeks ago to make the zephyr
mirror script restart itself automatically (by splitting it into
zephyr_mirror.py and zephyr_mirror_backend.py) had a poor interaction
with our code for killing old zephyr_mirror processes (to prevent
double-mirroring).  If you manually ran two copies of the outer
mirroring script (zephyr_mirror.py), then the second one would on
startup kill the first one's zephyr_mirror_backend.py children (for
being duplicate zephyr_mirror_backend.py processes that would result
in double-mirroring).  However, importantly, it did not kill the first
mirroring script's zephyr_mirror.py parent process, so the first
mirroring script would then proceed to startup up new children.  The
process then repeats, with the two scripts' roles reversed.

This issue didn't affect the sharded mirroring case, where I had been
doing the testing of the kill code with that refactoring, because we
don't have a version of the outer zephyr_mirror.py loop for that
situation (a consequence of it being hard to restart the threads
properly with the run_parallel API that we're using to spawn all the
children).

(imported from commit d4886ac77312a6b0ebd0d612f6fb084970bf23a2)
2012-12-21 12:44:19 -05:00
Tim Abbott 470ff676e6 zephyr_mirror: Fix insecure temporary file for log.
This is probably a lot more annoying to use, in that e.g. there are
separate log files for the two directions of the mirror, but we
haven't used these logs for much, so whatever.

(imported from commit d3bc407d90099214d242526c01cd3d3cd9d9d9bd)
2012-12-20 14:30:20 -05:00
Tim Abbott 6173ed509c zephyr_mirror: Add a few more restricted-access classes.
(imported from commit 6690e5dcd6a313ac4e4ef2351e300306ca7fb3c5)
2012-12-19 08:49:14 -05:00
Tim Abbott 09c53ccf38 check-mirroring: Fix spurious double-sent messages due to ACK failures.
(imported from commit 9010bd08779ce3bf9ce1dca761910be504b6463a)
2012-12-18 13:13:43 -05:00
Waseem Daher 1cf4bcfb3b Don't consider hyphens to be an acceptable place to wordwrap.
Otherwise, URLs like this one from catherio:
  http://www.sadiemagazine.com/issue-no-11/arts-letters/comic/i-think-i-am-in-friend-love-with-you
don't go to zephyr as one line, which makes them really
annoying to click on barnowl, etc.

(imported from commit d14f0af7d24a6cb8bc7cb0582f60116308f59923)
2012-12-18 11:03:18 -05:00
Tim Abbott 6b85b76de9 check-mirroring: Fix hardcoded logging path.
(imported from commit 93b0d27285f79ecd7286cc07bc7727f754bc8012)
2012-12-14 17:34:37 -05:00
Tim Abbott cefd4baae9 check_mirroring: Fix sharded stream names and add test for them.
The original ones were incorrectly computed with a trailing newline
character.

(imported from commit 8f4e4e436104aec33e858fa7a65583a1dbc2eaff)
2012-12-14 17:34:37 -05:00
Tim Abbott bf95839e27 check-mirroring: Try receiving zephyrs multiple times to avoid large queues.
(imported from commit 08c08df46794cd89db19748c3d5adfa4097de4cb)
2012-12-14 17:34:37 -05:00
Reid Barton f48e875d13 api: Pass along --site in init_from_options
(imported from commit a893c098b92690214a90a572ab54504d93da29e6)
2012-12-14 16:15:39 -05:00
Luke Faraone f76ea63b77 Document humbug-send and humbugrc in README for API users
(imported from commit 9ca282d4d768f2d2a474da1209621f03147954fe)
2012-12-12 16:48:00 -05:00
Luke Faraone 2da0a2275c Switch to the option group pattern for API examples.
(imported from commit 67d0164df822a56f06d5f959297cc2efa9706001)
2012-12-12 16:48:00 -05:00
Luke Faraone 5a0f1897bc Add humbug-send, a more full-featured sending tool.
(imported from commit 631f3c7320192a502b60bc4c4838d068ed60ee76)
2012-12-12 16:48:00 -05:00
Luke Faraone 0057c04e13 Update copyright notices for consistency, use the copyright symbol.
No textual changes were made besides reflowing text and subbing © for
(C).

(imported from commit e36108ad31be6ec65325e4ac48e9fb7d17e409ff)
2012-12-12 16:48:00 -05:00
Luke Faraone d69d935b7c Use a configuration file for API variables.
(imported from commit 784483949f29c865ad1eac522c61e2ee42f406e8)
2012-12-12 16:48:00 -05:00
Jessica McKellar 1ab592f81a feedback-bot: fix display_recipient typo that crashes the bot.
(imported from commit 79ec561fe60074b0eec23780c6d6977a64c86a00)
2012-12-11 10:22:52 -05:00
Tim Abbott dd42d844aa check-mirroring: 'Detected server failure' notices go to stdout, not stderr.
(imported from commit 9118b59130aaad274180c3c639ec897bc5634b9f)
2012-12-11 08:55:17 -05:00
Tim Abbott dbaeb9b1d5 zephyr_mirror: Add comment explaining why we drop the @ATHENA.MIT.EDU in zwrite -C.
(imported from commit b591e2e0d6c607ef04e3c0005091078cfe23e3ff)
2012-12-10 17:05:04 -05:00
Tim Abbott fb574966e1 zephyr_mirror: Improve debugging output on outgoing messages.
Previously all that we logged was the sender, which turns out to be a
constant for humbug=>zephyr mirroring.

(imported from commit 527a3ac4b9b815a2b4d6b63c3ad92d9d5ad99a6e)
2012-12-10 17:05:04 -05:00
Tim Abbott 0532d4b49e check_mirroring: Retry automatically on 'Detected server failure' errors.
(imported from commit 2f834218bd492876749dd8953e522725935a7a1d)
2012-12-10 17:05:04 -05:00
Tim Abbott 635c5f3d1f check-mirroring: Use zwrite -n to not send PINGs.
(imported from commit e345f1b86c7f8850ac4eb4ae092cc83717e2cbe8)
2012-12-10 17:05:04 -05:00
Tim Abbott 2d1e072896 zephyr_mirror: Fix handling of Humbug=>Zephyr personals.
(imported from commit 149f8aaf9076583499392bcb09a0250b05c3dea6)
2012-12-08 13:05:44 -05:00
Tim Abbott 17a0246b0b zephyr_mirror: Use a variable for humbug_account_email.
(imported from commit 90da406a5eab67d20b42243e96b8afb3e5b5f342)
2012-12-08 13:00:22 -05:00
Tim Abbott c241713332 zephyr_mirror: Fix detection of personals.
(imported from commit 1fc9050bad36dc15e76f65bdb6532e3e7e601a40)
2012-12-05 12:50:14 -05:00
Tim Abbott b00f23e21f Don't send zwrite pings.
(imported from commit 8dd7894eda6315ab52e61489e21ec1d201e86cc9)
2012-12-05 12:04:18 -05:00
Zev Benjamin 7e4776322d [manual] Unify huddles and personals into private messages on the receive path
feedback-bot and zephyr_mirror will need to be updated and restarted
when this is deployed to prod.

(imported from commit fe2b524424c174bcb1b717a851a5d3815fda3f69)
2012-12-04 18:01:51 -05:00
Keegan McAllister 62fff3b900 Add a Tddium post-build notification task for CUSTOMER1
Resolves #502.

(imported from commit b88fa55ea6561b601a3d6519c84d56ba3098c3fe)
2012-12-04 14:25:44 -05:00
Tim Abbott ef992fc8ba zephyr-mirror-crontab: Fix truncation races.
(imported from commit f50f34b3a739e67f2dffb442ac01e50eb7c9e4b8)
2012-12-03 17:56:38 -05:00
Keegan McAllister ae0d007e56 mirroring: Fix import by putting 'api' path first
(imported from commit b35d962d6456f01b97deeeaa328faa03b65494f8)
2012-12-03 17:50:29 -05:00
Keegan McAllister 0f0ff53527 zephyr_mirror_backend: Rename variable 'humbug'
(imported from commit 2e278e4d2452f750cb874510a762fc9616e7dfb3)
2012-12-03 17:49:27 -05:00
Keegan McAllister 25f0eb67bf gcal-bot: Rename variable 'humbug'
It's weird to clobber the module, although it works.

(imported from commit 160d6e1c596ba6618c3da9c8cdc2f5cd3ca43dc6)
2012-12-03 17:49:27 -05:00
Tim Abbott 021a897786 Add zmirror's crontab to git.
(imported from commit 37c96933a507c661c2ca252c78e5cd9e8a699ba2)
2012-12-03 16:20:19 -05:00
Tim Abbott 0fe3d93fbc zephyr_mirror: Fix case issue in subscriptions syncing.
(imported from commit e87ddab3684f4acae940ee831caadbc346458a11)
2012-12-03 16:20:19 -05:00
Keegan McAllister 82475afe82 Fix module and class name in api/README
(imported from commit c5157d52479ef0e1f26c471df79ffb9c5ea7f51e)
2012-12-03 15:54:54 -05:00
Keegan McAllister 7a080c7911 gcal-bot: Remove .humbug-api-key reading
This behavior is part of api/humbug.py now.

(imported from commit 8a9722c8ad05391160cbb98387f34ef9924d81de)
2012-12-03 15:54:54 -05:00
Keegan McAllister 9125489c20 Rename class HumbugAPI to Client
(imported from commit 4270f31fc5febcd9c444d0d133a1dad3860618f0)
2012-12-03 15:54:54 -05:00
Keegan McAllister bd7b7adb6b Rename api.common to humbug
Fixes #482.

(imported from commit 1bd6a7fd993d8d5e225e0311c288dbce0c369a40)
2012-12-03 15:54:54 -05:00
Tim Abbott 70a8e51351 Rewrite check-mirroring to be more robust and flexible.
Features include:
* Not forking into two processes (shells out to zwrite to send
  instead).  This makes life easier since we're not doing concurrent
  programming.
* Eliminated a lot of hard-to-read or unnecessary debugging output.
* Adding explanatory test suggesting the likely problem for some
  common sets of received messages.
* Much less code duplication.
* Support for testing a sharded zephyr_mirror script (--sharded).
* Use of the logging module to print timestamps -- makes debugging
  some issues a lot.
* Only one sleep, and for only 10 seconds, between sending the
  outgoing messages and checking that they were received.
* Support for running two copies of this script at the same time, so that
  running it manually doesn't screw up Nagios.
* Passed running 100 tests run in a row.

(imported from commit a3ec02ac1d1a04972e469ca30fec1790c4fb53bc)
2012-11-30 17:57:52 -05:00
Tim Abbott 4dc47bcd33 zephyr_mirror: Move class name canonicalization earlier.
We should be canonicalizing stream names to class names in
update_subscriptions_from_humbug, before we even decide which classes
to subscribe to; otherwise deduplication and tracking of which classes
we're already subscribed to won't work.

(imported from commit a751b6fca1022390a087516a0730ff77f13d7edf)
2012-11-29 13:57:06 -05:00
Tim Abbott 1bc98a6f8a call_on_each_message: Remove dead 'first' parameter.
(imported from commit 06885bf8049238184226d9fc7b64345e6848931a)
2012-11-29 13:57:06 -05:00
Tim Abbott 735857008a api: Don't mutate the original request.
This causes e.g. call_on_each_message to switch to dont_block mode
after the first error.

(imported from commit b6a5a10970c987faf8017f0ddae4e0b64a513c6f)
2012-11-29 13:57:06 -05:00
Tim Abbott 7914bb78c6 do_api_query: Reduce error handling code duplication.
Also fixes bugs where the retry code wouldn't work correctly if
verbose wasn't set, prints out which API query had the error, and is
more consistent about printing something to end the "..." sequences.

(imported from commit 15c1e0e4a14c5c5559b43bafe4ec268451ee04f5)
2012-11-29 13:57:06 -05:00
Tim Abbott 0a278b55b9 api: Only retry up to 10 times on connection errors.
(imported from commit f395370120d5e7a635eec7b27e4d5ed0c48b774d)
2012-11-29 13:57:06 -05:00
Tim Abbott b699ad6cde zephyr_mirror: Add options to run class mirror without sharding for debugging.
(imported from commit 4fcc403504d93e30aca6046cba9f1fe5342faac6)
2012-11-29 13:57:06 -05:00
Tim Abbott b3c1f08b3b zephyr_mirror: Don't leak zephyr_mirror processes on send_humbug failures.
(imported from commit be005018672369683d9e3bdbf144f96f58af6b6c)
2012-11-29 13:57:06 -05:00
Tim Abbott b54e5eb3c0 zephyr_mirror: Replace bare excepts with 'except Exception'.
(imported from commit 857212e0e5116471e418d37845550108c0a47d2b)
2012-11-29 13:57:05 -05:00
Tim Abbott de3799589b zephyr_mirror: Compare zephyr subs from server after normalization.
(imported from commit eea290698e83c7d26f23ab3bb0201914417f0e09)
2012-11-28 22:26:10 -05:00
Tim Abbott 18aace499c zephyr_mirror: Add two more restricted access classes.
(imported from commit 06ff0e19c1522ade018aea66f152fdfa55c18e1d)
2012-11-28 22:26:10 -05:00
Tim Abbott d23a83ee81 get_updates: Replace "failures" with the new dont_block option.
(imported from commit 2b4ecb35c4f14b6c408323662ef6f39c6485c62d)
2012-11-28 17:41:38 -05:00
Tim Abbott a1d8e9d30f get_updates: Replace the "mirror" argument with checking "client".
(imported from commit bd84c2c7a456de8ea7ec35eaf76b5bf8647ca61a)
2012-11-28 17:41:38 -05:00
Tim Abbott f58898fba7 zephyr_mirror: Pass an encoded stream to hashlib for sharding.
(imported from commit cc57b3956198b66c9cfc84423434a71b8200d819)
2012-11-28 15:44:35 -05:00
Tim Abbott 9505b38004 zephyr_mirror: Validate zephyr subscriptions happened successfully.
(imported from commit 494895b87eb9b555175c9890c5c2046cf4ce40ac)
2012-11-28 15:44:35 -05:00
Tim Abbott 84ab466ff3 zephyr_mirror: Fix display of personals on non-message classes.
(imported from commit 42ff030d2d78c530428dcede406d46fc71521fef)
2012-11-27 14:12:19 -05:00
Keegan McAllister e4b7fcc2d9 send-nagios-notification: Expand "\n" escape sequences that we get from Nagios
(imported from commit 3e8efbfe8bbd5a2f13a8e02d9f44442b035113ba)
2012-11-27 14:08:49 -05:00
Tim Abbott 2f198a50c1 send_message: Accept subject and message arguments.
(imported from commit 93aca5e750fa74d7ee95d8a00adbf6d4e61b2fc8)
2012-11-27 14:02:24 -05:00
Tim Abbott 8cf9012977 zephyr_mirror: Run the class mirror in 16 parallel shards.
(imported from commit cb17ef999e94cc57d5b01114479728b04475c9c4)
2012-11-27 12:09:57 -05:00
Tim Abbott af40020ff9 zephyr_mirror: Add a --no-forward-from-humbug option.
We'll use this to only have one of our shards forward from Humbug.

(imported from commit a6f3c2180b49c1fa826baf1ae9e7e3ba252a5bfa)
2012-11-27 12:09:57 -05:00
Tim Abbott cdabd2b90a zephyr_mirror: Clean up unnecessary logic in process_notice.
(imported from commit 28599789016fd1006c2de4d5ddc3cf1f10baa47f)
2012-11-27 12:09:57 -05:00
Tim Abbott 4b6f771be1 zephyr_mirror: Fix the check for whether a Zephyr is a personal.
(imported from commit 609b6339fa82ecbd6435a386d24bf555e75a8120)
2012-11-27 12:09:57 -05:00
Tim Abbott f05967034b zephyr_mirror: Reorder process_notice to log fewer "Skipping" messages.
Previously, we were sending "Skipping message we got from Humbug!"
for messages we wouldn't have forwarded anyway.

(imported from commit 36df85a61336ac00e3d7913d5a417d6b42764350)
2012-11-27 12:09:57 -05:00
Tim Abbott a9b938d7ac zephyr_mirror: Don't display/log some useless "Skipping" notices.
In this case, if we're configured to not forward personals, there's no
point in logging a decision not to forward one.

(imported from commit 62c37591c6a70afb6235de626b0c6a3502cbcb27)
2012-11-27 12:09:56 -05:00
Tim Abbott 09c5a5c06f zephyr_mirror: Simplify optparse usage.
(imported from commit d7cce4236dae6f369ea1cc4e12f89c2011718b7f)
2012-11-27 12:09:56 -05:00
Tim Abbott 08bbf889ed api: Extend documentation a bit.
(imported from commit fd435286e12ffebad8476cc8005303b2d8d70fd9)
2012-11-27 12:09:56 -05:00
Tim Abbott 9c7878164c check-mirroring: Fix some issues with startup process timing.
It seems that check-mirroring was reporting a lot of spurious failures
due to it sometimes taking more than 3 seconds for the setup phase of
check-mirroring's receive path to run.  So fix this:

(1) Wait a bit more than 3 seconds for the receiver to subscribe to
messages

(2) Subscribe to Humbug messages before forking (we can't do this with
zephyr.init() because python-zephyr gets totally messed up if you use
it from multiple processes with a shared initialization)

(3) Get rid of the old time.sleep(0.x) values that were intended to
make messages arrive in order -- since we're now checking that
messages correctly arrived using set(), they aren't needed.

(4) Use a single request to subscribe to both zephyr classes we need
to subscribe to (saves 1 RTT).

(imported from commit d96aef05405ce43e9a4a549de189da9a2e393875)
2012-11-26 17:10:15 -05:00
Tim Abbott 369f5e9d80 zephyr_mirror: Don't use @(@color(blue)) in zsigs.
(imported from commit e4b594e3c22c25fa4f87baaad09227396bb92a0d)
2012-11-26 16:19:09 -05:00
Tim Abbott 789a5c5e2d zephyr_mirror: Use default format to indicate what came from Humbug.
(imported from commit 5c2fdccb08d605a37d6c87c37f023c06a0a9a760)
2012-11-26 16:18:05 -05:00
Tim Abbott e16e5f7e1a zephyr_mirror: Refactor zwrite_args handling a bit.
(imported from commit 4923c90dc546022d48f226c2a204e9d09717b563)
2012-11-26 14:58:34 -05:00
Keegan McAllister 9274ff20d5 examples/send-message: Remove default sender
(imported from commit 30ada075ac4f1b759fe787eef6a93275dbea584c)
2012-11-26 14:57:20 -05:00
Keegan McAllister 128302a7ff api/examples: Simplify optparse use
- The default 'default' is None
- The default 'dest' is the option name, with - replaced with _
- The default 'action' is 'store'

Not coincidentally, these defaults are correct for most of our existing code.

(imported from commit 9c6078bd778324e08e1ca214a97281a7bdce08c2)
2012-11-26 14:57:20 -05:00
Keegan McAllister ca723aed43 api/common.py: Ensure that the API key file is closed when we're done with it
(imported from commit 87a0feb52952aa76bec041d032027e7a272156fc)
2012-11-26 14:57:20 -05:00
Keegan McAllister a09c9de17c api/examples: Rework sys.path computation
(imported from commit 6e4c2a9b5f5ab6f6680704a1e06bd17fd95bd038)
2012-11-26 14:57:20 -05:00
Keegan McAllister c1994f3886 api/common.py: Reduce code duplication between API call methods
(imported from commit 4a0f1a8479c21366bf552edf98401b03bad72d9c)
2012-11-26 14:57:20 -05:00
Keegan McAllister 8576446791 Use a new-style class for HumbugAPI
(imported from commit a88366e0129dadb40b058ddd0ede64db3b6b206f)
2012-11-26 14:57:20 -05:00
Keegan McAllister d7b3afef6b Send Nagios alerts to Humbug
Fixes #385.

(imported from commit 7dac013debd6ccff031fc4da0dd7185e198b4498)
2012-11-26 14:42:55 -05:00
Tim Abbott c86fd609e2 Add tool to build an API tarball for distribution.
(imported from commit eeaf9f526f243cc628eede603fe1b1691c34977f)
2012-11-26 12:25:39 -05:00
Tim Abbott 9c0e0844ef check-mirroring: Add subscriptions inside IOError check.
(imported from commit d3b00ce9d91a0bcffcef58436a4b90770155fce9)
2012-11-26 12:25:39 -05:00
Tim Abbott f7101aa3ef api: Add an extra send_message example.
(imported from commit fe5ab550fa862f587cdf7987c5b238dffab45672)
2012-11-26 12:25:39 -05:00
Tim Abbott 32f91f4ab0 api: Don't use 127.0.0.1:8000 as an example.
At least the zephyr.humbughq.com case is one our users might find
useful.  I imagine we'll end up hiding --site once we integrate the
zephyr and main site tornado servers.

(imported from commit a3a28492cf3f32b78eab6bbd48ba66be2f38a5f2)
2012-11-26 12:25:39 -05:00
Tim Abbott 3cc5973511 api: Add copyright and MIT license notices to distributed tools.
(imported from commit 9f93050f988549dc363f5a7c798c8a9fa1c01d29)
2012-11-26 12:25:38 -05:00
Tim Abbott e3f6a6a752 api: Remove hardcoded API keys from examples.
(imported from commit 64bf22298452a436d0aec796973a77f10d5e0bf9)
2012-11-26 12:25:38 -05:00
Tim Abbott 7314c12527 api: Read the API key from ~/.humbug-api-key by default.
(imported from commit 309469a0955969eafd78fbdf89d9651cb530010d)
2012-11-26 12:25:38 -05:00
Tim Abbott 6ac25fb9ba zephyr_mirror: Don't break long words/urls when mirroring.
(imported from commit df2b6a6969fc54016eeee4996df317e2843844c8)
2012-11-21 15:55:18 -05:00
Tim Abbott f72427d83c zephyr_mirror: Fix running --sync-subscriptions repeatedly.
(imported from commit 15bead790590c91cd4a1d794799f94341d31c181)
2012-11-20 17:17:40 -05:00
Jessica McKellar f1fc271258 nagios: Increase the timeout on MIT zephyr forwarding functioning.
Sometimes messages are delayed passed the allowed 10 seconds. We may
eventually decide that that amount of latency is unacceptable, but the
latency is not what this script is supposed to be checking.

(imported from commit d83a6a83d60e9eac13b3b87fb31de7f9881acabf)
2012-11-20 15:32:06 -05:00
Tim Abbott 5587b502a2 zephyr_mirror: Add exception handling around all main loop code.
(imported from commit 5dc46decf882302a6c58f3bb788362f82f293b35)
2012-11-19 12:44:12 -05:00
Tim Abbott ab9858ba65 zephyr_mirror: Use minimal wrapper script that is hard to accidentally break.
(imported from commit 45967b8b806df616b0480b217dd5db82c5a2cabd)
2012-11-19 12:44:06 -05:00
Tim Abbott c0f649559c zephyr_mirror: Move parse_args into its own function.
(imported from commit b56ca627e3d34b8dcefead2cfecfa77bb428b0ec)
2012-11-19 12:30:15 -05:00
Tim Abbott 235654e022 zephyr_mirror: Get rid of extra_mirror code -- it is no longer used.
(imported from commit ab2a9cfcfa6a8c7615523ebb16864e9a4db05f3a)
2012-11-19 12:11:07 -05:00
Tim Abbott 2045bdae77 zephyr_mirror: Improve robustness when killing child processes.
(imported from commit f212b87ffb1fc814d289c14d3854fb1f2f6e2cf3)
2012-11-19 11:46:05 -05:00
Tim Abbott e9bc9ac3c2 zephyr_mirror: Fix restart_stamp functionality.
(imported from commit a79db110d3372ab88fabfc0b7013c5fd3ad07f8e)
2012-11-19 11:20:33 -05:00
Tim Abbott eac3ae2ed1 zephyr_mirror: Improve zwrite error handling.
(imported from commit a6b5b9c0c9bd6ffde0b2b783c87528bdcae03566)
2012-11-16 17:08:51 -05:00
Tim Abbott 6026c80de6 API: Add unsubscribe function.
(imported from commit 6dc55e9030770500770ce3921a4e77499d64f2d6)
2012-11-16 17:06:01 -05:00
Tim Abbott f5ccde78e3 [manual] Use "subscriptions" for {add,list}_subscriptions consistently.
This change requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit a31d6efd2db4d4617c7c6b00326be3f07c7263da)
2012-11-16 17:06:01 -05:00
Tim Abbott afc62a8e16 [manual] Uniformize the subscriptions API method names.
This requires a zephyr_mirror deployment when it is pushed to prod.

(imported from commit 6543441fb264b518f8705d7989d068a1d50ce5d6)
2012-11-16 17:06:01 -05:00
Jessica McKellar b48671ae43 nagios: print more information on check-mirroring errors.
(imported from commit 6ea149d939ae309745ce8c5b2ab7ae2237007d97)
2012-11-16 11:25:22 -05:00
Tim Abbott 18a6014fa3 send-message: Add sending to streams and some code cleanup.
(imported from commit 806b17bd959f643a7422f9fcf5d24d6f945a18c2)
2012-11-15 15:31:48 -05:00
Tim Abbott 411a7f6b4f [manual] send_message: Rename recipient/stream fields to 'to'.
This commit changes APIs and requires and update of all zephyr
mirroring bots to deploy properly.

(imported from commit 2672d2d07269379f7a865644aaeb6796d54183e1)
2012-11-15 15:30:06 -05:00
Tim Abbott 9e7802cd51 check-mirroring: Use consistent ordering for keys.
(imported from commit 7deaf55ccb4b47a11dbd30c9239893a42eb39e00)
2012-11-15 14:56:10 -05:00
Tim Abbott a11a4dceb7 zephyr_mirror: Improve error handling getting public streams list.
(imported from commit 06f9c00f19056bfe7db3c02955e3a29ad270de6e)
2012-11-15 14:51:05 -05:00
Tim Abbott 56c6d93e8a zephyr_mirror: Send Humbugs in child processes.
This improves the throughput of mirroring a large number of zephyrs in
a row from about 1.5/second to about 9/second, which is basically
satisfactory.

(imported from commit 5f72680d6290eaa02ef8ced5b3792fb3efc1db41)
2012-11-15 14:50:59 -05:00
Waseem Daher 11c7d0e841 Ask user to reload Humbug after running sync-subscriptions.
(imported from commit d374d5b8eefd4240b8b11f83080fcdf2ff3cadaf)
2012-11-15 10:40:10 -05:00
Jessica McKellar c447a7ba94 If a zwrite fails, retry unauthenticated and warn the user.
(imported from commit a8a516d59f4af72ed2eaebb6bfa65e2f359fc2a6)
2012-11-14 17:38:42 -05:00
Zev Benjamin 3cf6b27ec4 Make send-message API example program more flexible
(imported from commit e1fa90169500f84b088f1697c31641c24ed93bc8)
2012-11-14 17:35:38 -05:00
Tim Abbott 50b8195bf3 api: Fix type error updating the failures count.
(imported from commit 5733f252f676549ff817df3a7560274ecec0cd2a)
2012-11-14 15:03:49 -05:00
Tim Abbott aecb8bd849 zephyr_mirror: Don't use the /mit symlink for use on systems without automounters.
(imported from commit b376e6da6c971d887f2d75194a8ed0d3adaddfea)
2012-11-14 15:03:49 -05:00
Tim Abbott c00628d149 zephyr_mirror: Don't try subscribing to an empty stream list.
(imported from commit c8155459b768dd1fc192246c1f584abb30a7bc02)
2012-11-14 15:03:49 -05:00
Tim Abbott 2e11624b2f zephyr_mirror: Don't send fullname data to server.
(imported from commit 743d0109f422fea5c4642e83448cd179f4e60827)
2012-11-14 15:03:49 -05:00
Keegan McAllister 268492c45d gcal-bot: Get API key from ~/.humbug-api-key
(imported from commit 63d63ad0d299c300d28de61069ada8ea2c8eb839)
2012-11-14 10:38:36 -05:00
Keegan McAllister 0d5c67c792 gcal-bot: Fix sys.path for new location under api/bots/
(imported from commit 9f5b90d5e0cd2134f2f0210980ad49fd8062a9c4)
2012-11-14 10:38:36 -05:00
Zev Benjamin 0a930cd87a zephyr_mirror: forward messages in test mode if the site is not the default one
(imported from commit 7d504a6d555866f12f1657b522b4e6eb380c64a3)
2012-11-13 20:22:37 -05:00
Zev Benjamin 195bdb07c9 Unify huddles and personals into private messages on the send path
Personals are now just private messages between two people (which
sometimes manifests as a private message with one recipient).  The
new message type on the send path is 'private'.  Note that the receive
path still has 'personal' and 'huddle' message types.

(imported from commit 97a438ef5c0b3db4eb3e6db674ea38a081265dd3)
2012-11-13 15:40:53 -05:00
Zev Benjamin 33c23c0113 Use a JSON array for recipients in send_message
(imported from commit e2184f92b708cc2e8ef3e9ae79ee4241c0aa12a1)
2012-11-13 15:40:53 -05:00
Tim Abbott 375062d14c zephyr_mirror: Extend logging on subscribe failures.
(imported from commit ce54549a74935bb95cb68dd1e6db2a3eec6166c5)
2012-11-13 12:47:59 -05:00
Tim Abbott 04d18d2461 zephyr_mirror: Tweak linewrapping algorithm.
(imported from commit 1165a7680251f6bb365f44a60612fffe0fbbae42)
2012-11-13 12:43:37 -05:00
Tim Abbott 832688d521 zephyr_mirror: Use python logging module.
(imported from commit 3cd9506d46eb56fbd5a48c789160a45846332633)
2012-11-13 12:43:14 -05:00
Zev Benjamin ef99a53465 api: Generically convert non-string values to JSON in python bindings
(imported from commit 820bc20d469832b5785b434726c81e59a3f67ea5)
2012-11-09 18:08:31 -05:00
Tim Abbott 7cafd7c6d0 zephyr_mirror: Support whitespace-only zephyr instances.
Previously messages sent to zephyr instance " " wouldn't be forwarded
zephyr=>humbug because the target instance is the null instance; I
learned this when we got a few tracebacks in the zephyr_mirror log, so
clearly this does happen.

(imported from commit 08bd7470e75ac6af24ac83696b6cf68d70654664)
2012-11-09 17:32:15 -05:00
Tim Abbott cdd9c80499 zephyr_mirror: Catch IOError from zephyr.init().
(imported from commit d657fede53ee3754e76edf66b10bef09ad1f9577)
2012-11-09 16:56:14 -05:00
Tim Abbott 6716126c6e api: Sometimes python-requests raises an SSLError on timeout.
(imported from commit 7f64659acf124819c04b5ecd67eaa5b5fddc71fd)
2012-11-09 16:56:14 -05:00
Tim Abbott 957a996322 api: Distinguish Requests connection errors from server 500s.
(imported from commit 1879ea4030c2441c049d9c68684b33a1d2444572)
2012-11-09 16:56:13 -05:00
Tim Abbott 1f3cf7bbd0 Fix sending to cross-realm Zephyr users.
(imported from commit 1eebf286e149aa1242d6d26096003eb696fb18f2)
2012-11-09 16:56:13 -05:00
Tim Abbott 8e973adb5b api: Add 55 second timeout when longpolling.
(imported from commit c5c1f9fcfa9ec5eff84f9bc7e98042f87193e98c)
2012-11-09 14:32:06 -05:00
Tim Abbott e6ea910f18 zephyr_mirror: Forward messages sent to the empty instance more clearly.
(imported from commit 1fb5e4f8ce9941b3ca89688821d325d7ae49aee5)
2012-11-08 17:48:15 -05:00
Tim Abbott 72a4d065cb zephyr_mirror: Add a test mode that just prints messages.
This is useful for trying out new versions of the forwarding code
while the mirroring bot is still running in production.

(imported from commit bcdaf91fed55ac0974b1efe31dd13ed006b6fd06)
2012-11-08 17:48:15 -05:00
Tim Abbott 45430e3af2 check-mirroring: Move some prints to be conditional on "verbose".
(imported from commit 90db591f5fc3e4d1f830ed16bca9380a3a9dddd3)
2012-11-08 13:47:02 -05:00
Tim Abbott bb3f030f7e check-mirroring: Make root_path and option (with new default).
(imported from commit df15d089f234bfe5373fc3fed95eb2f3b3ee42b2)
2012-11-08 13:34:32 -05:00
Tim Abbott a83ecc0618 check-mirroring: Don't fail when messages get reordered.
This happens sometimes (especially when our server is restarting), and
isn't a _real_ problem -- it's much more important that we have a
completely reliable test that we can put a Nagios alert against.

(imported from commit 0add0b3dfc5447307014bbb9137366bd7141ade0)
2012-11-08 13:34:29 -05:00
Tim Abbott 71e2e1cb1b zephyr_mirror: Support subscribing to non-ascii Zephyr classes.
(imported from commit 85437f09c4738df11208e623db566a9409e501a3)
2012-11-07 16:42:06 -05:00
Keegan McAllister e54e93dccb zephyr_mirror: Don't open /dev/null to disable logging
(imported from commit 804e627d6d70bbf2ae1ee2f467b79ed0582ced0f)
2012-11-07 16:36:40 -05:00
Keegan McAllister d7a2b0930e zephyr_mirror: Always pass a tuple to string %
(imported from commit 64a59e23c3aa3fceb350ed348812258c90ff09da)
2012-11-07 16:36:36 -05:00
Tim Abbott e7abe13cd6 The empty string shouldn't be a valid stream name.
(imported from commit 1fa878d7d51d3c3444ac75edf08b32f886683964)
2012-11-07 15:42:32 -05:00
Tim Abbott 935632428b zephyr_mirror: Use zephyr's bulk subscription functionality.
Previously we were spending 15 seconds on linerva (and more like 2.5
minutes on the not-yet-operational zmirror.humbughq.com) to subscribe
to all of our streams.

(imported from commit c36cb1c26868f142683d9c92d4875fcd4931886e)
2012-11-07 15:37:55 -05:00
Tim Abbott 7aaa08d9b2 zephyr_mirror: Eliminate the confusing "subs" global.
zephyr.Subscriptions() is a singleton class, intended to be accessed
as it is used.

(imported from commit f76c1b1129adb19ba96ed17f441492edf859a748)
2012-11-07 15:37:55 -05:00
Tim Abbott a87ac2dec9 zephyr_mirror: Fix missing api key file error message.
(imported from commit 3efe7fb8b2d593418c37dbab9389a8df9c27d003)
2012-11-07 15:37:55 -05:00
Tim Abbott 90439bbd9e zephyr_mirror: Make the logging options require the log path as an argument.
This is for supporting running the mirroring bot on a server without
AFS.

(imported from commit 400bf32f17aca984fa40c3b1222893214497eaa0)
2012-11-07 15:37:55 -05:00
Tim Abbott 36d5fabf29 zephyr_mirror: Use os.path.join for constructing the root_path.
(imported from commit d894ab68430e42233a7aa6b289f01e790f8c8586)
2012-11-07 15:37:46 -05:00
Tim Abbott 97aaa20b8c zephyr_mirror: Add option to change the root path.
This is relevant for running not out of AFS on Linerva.

(imported from commit 28549830c99ad5a52349fbcc9e53dcb3c5ef25a1)
2012-11-07 15:35:26 -05:00
Keegan McAllister a0232811b2 check-mirroring: Get the max_message_id from get_profile()
(imported from commit 95f457b91563a92eee24c4487c00abe7132b4ff8)
2012-11-07 15:34:44 -05:00
Keegan McAllister 05c6089c40 Add get_profile to Python API bindings
(imported from commit 8f39764f4dce95e30a355cfb4ef9bf63db097160)
2012-11-07 15:34:44 -05:00
Jessica McKellar 9077d51d54 For now, allow all characters in stream names.
We've had multiple requests from MIT zephyr users to allow
non-alphanumeric stream names, and we haven't decided what we want to
allow, so for now allow everything.

Note that the web client and mirror script limit stream names to 30
characters, which is our database limit.

(imported from commit 2acb5ee04e5ee7c40031ac831e12d09d04bbb2e6)
2012-11-07 15:12:03 -05:00
Tim Abbott 8752b3bf18 zephyr_mirror: don't crash when the zephyr server returns SERVNAK errors.
Zephyr has this great property where a small fraction of the time, the
Zephyr server rejects your attempt to subscribe to something for no
particular reason, returning a "SERVNAK" error.

(imported from commit 6d5ed033d46d77a5b02539a816453724740f8fb0)
2012-11-07 13:56:21 -05:00
Tim Abbott 837fdca1c4 feedback-bot: Only forward messages sent directly to feedback@.
(imported from commit 4a4d1e4a3ba00deb929647f7f35f2982c2b4add6)
2012-11-06 16:59:28 -05:00
Tim Abbott 9b8e5bc93f Bots: Send messages through staging.humbughq.com.
(imported from commit d9859bfe5f5b3b7c5efa5ef930d6cfaa5c0d1fc2)
2012-11-06 16:59:28 -05:00
Tim Abbott b281235a81 zephyr_mirror: Remove remaining AFS reads when restarting automatically.
This does introduce a small security issue, in that a shell with
expired AFS tokens on the machine running the mirroring script will be
able to read the Humbug API key using /proc/pid/environ.  I think this
is fine -- you can steal the API key from a running process using
ptrace anyway.

(imported from commit c6fdb798294fb32d640823b409f3e46274ca01f4)
2012-11-06 15:10:11 -05:00
Tim Abbott 0717665b69 zephyr_mirror: Zev's proposed fix to latest linewrapping problem.
(imported from commit 90fc4774e10255d0237a37b8af753059a66efb2d)
2012-11-06 11:31:37 -05:00
Tim Abbott c04815ad38 zephyr_mirror: Add support for importing as a library.
(imported from commit 91dc7e8fae89ba8ade8dd98b747a25b46fca13e7)
2012-11-06 11:31:37 -05:00
Tim Abbott 08d75c5c64 zephyr_mirror: Speed up retrying the restart process.
(imported from commit 7f7a2aaa8a7f872180400f57ad09c065ea2ababa)
2012-11-05 18:39:02 -05:00
Tim Abbott 8a870047db zephyr_mirror: Also linewrap with extremely long strings.
(imported from commit cffa80f283fdac341942beb56ada9013cb8f7c39)
2012-11-05 18:39:02 -05:00
Tim Abbott 298ceb13a7 zephyr_mirror: Only strip trailing whitespace.
(imported from commit f349778200e0c2fb410e5e2644c82ba4105f3634)
2012-11-05 18:39:02 -05:00
Tim Abbott a4a94050e6 zephyr_mirror: Improve different-paragraph detection algorithm.
(imported from commit 789651dd5b9af58bbc0e59a64dd565f06585134d)
2012-11-05 18:39:02 -05:00
Tim Abbott f07e0a6324 zephyr_mirror: Make paragraph break detection a bit less aggressive.
Because in the zephyr world, people often manually linewrap their
zephyrs, we need to relax the algorithm's assumption that every line
was wrapped to the same linewrapping threshhold.  Otherwise messages
that look like this:

aaaaa aaaaa aaaaa aaaaaaaaaa aaaaa aaaaa aaaaa aaaaa
aaaaa aaaaa aaaaa aaaaaaaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaaa
aaaaa aaaaa aaaaa aaaaaaaaaa aaaaa aaaaa aaaaa aaaaa

might be treated as a paragraph break, even though that was unlikely
to have been the sender's intention.

(imported from commit e1144da2a3efc3241a8f15b0f19fea2ea6684254)
2012-11-05 18:39:02 -05:00
Tim Abbott 850e70c592 zephyr_mirror: Fix name of MIT Zephyr realm.
(imported from commit 2c4d269fee673171fcbacbd865135d266489559d)
2012-11-05 18:39:02 -05:00
Tim Abbott 3af18006ce zephyr_mirror: Fix syncing instances of class message.
(imported from commit dfbbce336145ef6233eab27120a1ccefda055b13)
2012-11-05 18:39:02 -05:00
Tim Abbott bfae15c887 zephyr_mirror: Use SIGTERM to try to kill children.
It's generally best to first try killing with SIGTERM, and if we fail
to kill the child, we'll end up trying to kill them with SIGKILL
anyway when the new zephyr_mirror process starts up,

(imported from commit cfee2dd5f809f6e38d90a09be82719a8660d8377)
2012-11-05 18:39:02 -05:00
Tim Abbott bd60b071e5 zephyr_mirror: Use better line unwrapping algorithm.
(imported from commit e58ad67e98a9f2ec672162f955e49883d2dd3ab8)
2012-11-05 18:39:02 -05:00
Tim Abbott 605353027e zephyr_mirror: Encode the content as utf-8 before sending to zwrite.
(imported from commit 8bc578701a99f98eb5cc3e179fef696514da0066)
2012-11-05 10:20:40 -05:00
Zev Benjamin bd62c58a61 zephyr_mirror: do case-insensitive compare when checking for instanced personals
Users were seeing "[-i PERSONAL]" prepended to mirrored zephyrs.

(imported from commit 82f1c93705f4000607ad8fd733c9fb5045619b10)
2012-11-05 00:48:00 -05:00
Tim Abbott 61d42511fb zephyr_mirror: Don't try to forward Humbug cross-realm messages to Zephyr.
(imported from commit b14174d79c88dcaec57207cd8467aa14d9cf02ba)
2012-11-04 06:50:52 -05:00
Tim Abbott 18a5f9e1da zephyr_mirror: Comment subject truncation.
(imported from commit eb292b47d74388d9c0065661c8b6fef9ab6f3554)
2012-11-04 06:50:52 -05:00
Tim Abbott ebada01f91 zephyr_mirror: Fix handling of cross-realm Zephyr users.
(imported from commit c3739bcd383e73ef7f5347f0665e990a0d121a47)
2012-11-04 06:50:52 -05:00
Tim Abbott b798b66ba0 zephyr_mirror: Small logic fix in add_humbug_subscriptions.
(imported from commit bbcb7710310186612a8e7661a20b8b6558614758)
2012-11-04 06:50:52 -05:00
Tim Abbott d95d346afc zephyr_mirror: Clean up old mirroring duplicate suppression.
(imported from commit ada8b4747d329da8b84acc8d3ff4fa2a4d653938)
2012-11-04 06:50:52 -05:00
Tim Abbott 5686d25b45 zephyr_mirror: Parse zsig/body in its own function.
(imported from commit b692fa692d24d79f797852acffa0472d68930c88)
2012-11-04 06:50:52 -05:00
Tim Abbott 29ff3fd840 zephyr_mirror: Don't force-lower-case instance names.
(imported from commit 5b9b450ae7666a9c74704a7bd494c57a47578fe7)
2012-11-04 06:50:51 -05:00
Tim Abbott 45bffc8a0e zephyr_mirror: Reduce code dupliation in process_notice.
(imported from commit f0d371cfcd3f4f5443dea5dc8f96f53df160d179)
2012-11-04 06:50:51 -05:00
Tim Abbott f4fef79be3 zephyr_mirror: Clean up send_humbug() interface.
(imported from commit 76d53e83eacedead2dabbf921e240afc4e4d09db)
2012-11-04 06:50:51 -05:00
Tim Abbott 07f12b51c8 zephyr_mirror: Remove an unnecessary username parsing.
(imported from commit 56c27a6cd923f13e23b70914f85dd73661e27651)
2012-11-04 06:50:51 -05:00
Tim Abbott bcf34d6373 zephyr_mirror: Use a function to compute Zephyr usernames.
(imported from commit 73c066944942169d5a37fada110ed95aa2c10c94)
2012-11-04 06:50:51 -05:00
Tim Abbott e5df7b289c zephyr_mirror: Rename humbug_username to to_humbug_username.
(imported from commit 764673b9ccf2f58f88e1d6eec173a1c49ac15cad)
2012-11-04 06:50:51 -05:00
Tim Abbott 63a015f67d zephyr_mirror: Use %me% rather than guessing the current Zephyr user.
(imported from commit 8c04581c4327a44515b9ce1b938c69675964c6c0)
2012-11-04 06:50:51 -05:00
Keegan McAllister 9fd20692f8 Document why we need Requests > 0.12
(imported from commit 9c719d1bdd6446cedbb936449ad0225f387a0100)
2012-11-02 14:57:38 -04:00
Tim Abbott f75fc44a4e zephyr_mirror: Don't let a single bad message break humbug=>zephyr forwarding.
(imported from commit 9b20f5e9c661fe0850c119309f4fe6f2c5d40679)
2012-11-02 14:15:46 -04:00
Tim Abbott f8d5287581 zephyr_mirror: Shell out to zwrite instead of using python-zephyr to send.
This eliminates the problems with python-zephyr not being able to
handle non-ascii characters in instances and class names.

(imported from commit c9f295cb18bc5043cd8efecbe6996ff373f66c9a)
2012-11-02 14:15:46 -04:00
Tim Abbott c81515e6ac Use the empty string rendered in blue as the zsig loop avoidance token.
(imported from commit 10610b25b006f85b6557592ce73899381b520e3b)
2012-11-02 13:49:30 -04:00
Tim Abbott 795808e7cc zephyr_mirror: Support the empty string in blue as our loop detection technique.
(imported from commit 4f9c77df7479bfa485dac381514ee2c591ce09ef)
2012-11-02 13:49:29 -04:00
Tim Abbott 2279214600 Add copyright notice to zephyr mirroring bots.
(imported from commit f3d27a032a461cf3eb92822feee3f8e790d630dd)
2012-11-02 13:49:29 -04:00
Tim Abbott 3aab57a283 humbug_trac: Don't send some updates without a comment.
(imported from commit 2cf5e8c2fc1cefcbfe440b2e29d89b78f19205e6)
2012-11-02 10:50:59 -04:00
Tim Abbott f319eef425 humbug_trac: Remove redundant 'Trac ' in subjects.
(imported from commit 309b477963cd0d3cca06eef2a685b1143c144455)
2012-10-31 14:06:35 -04:00
Tim Abbott 31666a1f3d humbug_trac: Try to compress the rest of the changes.
(imported from commit a7bdf3cb8243d43837705d4c9eb00d5e6d75d4b5)
2012-10-31 14:06:35 -04:00
Tim Abbott b9c54ed6f2 Include the trac summary in the Humbug subject.
(imported from commit 23298d8455e2b0e8c4947f2d2e76874b66a8e28c)
2012-10-31 14:06:35 -04:00
Tim Abbott 212a4e76d4 zephyr_mirror: Append our elements to the start of sys.path.
(imported from commit 674848bcac71d5bd28549f14a5da0f72c6c59d69)
2012-10-31 14:06:35 -04:00
Tim Abbott 013a2381b2 zephyr_mirror: More reliable killing of other zephyr_mirror processes.
(imported from commit ae00299114a74ebd582aec835ffd5f8127d8f55f)
2012-10-30 16:59:25 -04:00
Tim Abbott 73f6c614b8 Move trac bot to the trac stream.
(imported from commit 7c05062d73d6bd4de4b9329f1f2b7baa705c9d2b)
2012-10-30 16:59:25 -04:00
Keegan McAllister 270912e582 zephyr_mirror: Remove 'continue' at the end of a loop
(imported from commit 5d6143828f1a6946b67ae23342c0bc2185ebee07)
2012-10-29 23:21:00 -04:00
Keegan McAllister cae174847a zephyr_mirror: Use a set for current_zephyr_subs
(imported from commit 2736ea13dac7d3b5914eac27ed92ddacafd6ee8e)
2012-10-29 23:21:00 -04:00
Tim Abbott 9c5136c8cc zephyr_mirror: Clean up some code duplication.
(imported from commit ab21fc28d167d6f74e9d93aa8a7ccb252b5664c2)
2012-10-29 18:57:54 -04:00
Tim Abbott 6e31e7d405 zephyr_mirror: Set subject to personal if it is empty.
(imported from commit c843199287ab693f9f325ca0216cee59f8accdb3)
2012-10-29 18:25:03 -04:00
Tim Abbott ddf131143c Improvements to .zephyrs.subs parsing.
(imported from commit b1ddbf4416f4b04201a66409bdc48a469801b9de)
2012-10-29 18:25:02 -04:00