Commit Graph

621 Commits

Author SHA1 Message Date
Leo Franchi 8b11b835ae Remove demos/ from setup.py install as it's no longer there
(imported from commit 5a0deb8fcf3ebdb79115d4c573b5770ad4a6ca52)
2013-10-02 17:41:21 -04:00
Steve Howell f26a23a5fa Have Jira Groovy client send client=jira-groovy to our API.
(imported from commit 9186c5a8ac9ac910e914eaa342040f595b38a052)
2013-10-02 15:28:36 -04:00
Leo Franchi 8a1b904a2d Move RSS and Twitter bots to integrations/
(imported from commit a8105d5161eae6708d6322037cd6a45bef237050)
2013-10-02 11:37:05 -04:00
Leo Franchi 54d83a3a36 Add a Codebase integration
(imported from commit d1ea870cd6ac6bf5d00c03d8859d66638d3242e8)
2013-10-02 10:55:17 -04:00
Tim Abbott e5b3f08b04 trac: Include ticket summaries in body if they were truncated.
(imported from commit df1bd5e765725d077cc30ce92eac8bf694145044)
2013-10-01 17:41:30 -04:00
acrefoot c5f8ffc767 Make call_on_each_{message,event} examples more clear
Before these examples weren't obviously blocking calls (they seemed
more like a callback registration, which may make more sense in the future)

(imported from commit 78fdf98d791b19843526437c710901d8dff62e8c)
2013-09-24 16:19:54 -04:00
acrefoot 9e690e8625 Fixup 484bc12681a43cd01fe0189c072ab4230eb32c22 typo
(imported from commit ff4043b6ea0c2389560114dcda6269fd64932cd5)
2013-08-29 18:07:49 +00:00
acrefoot dc175c9427 Basecamp mirroring script
This mirrors all the "events" in a Basecamp account onto a stream in Zulip
(default "basecamp"); it sets the topic as the calendar or project that the
event belongs to.

Unfortunately, Basecamp will not host hooks, and neither do we, so this script
is currently intended to be run by our customers, much like the Trello mirror.

(imported from commit 484bc12681a43cd01fe0189c072ab4230eb32c22)
2013-08-30 20:00:07 +00:00
Tim Abbott f5f95e5f43 [manual] Extend /api/v1/streams API endpoint.
Previously it only provided the list of all public streams; now it
allows one to specify any union of some of the following:
* all public streams
* all streams the user subscribed to

(the most relevant being the union of those two, which is what we want
for the "streams" page).

Or:
* all streams in realm (superuser only)

The manual task required is that when this is pushed to prod, we need
to also deploy the new sync-public-streams version to zmirror.

(imported from commit 27848b8bd136e2777f399b7d05b2fdcec35e4e21)
2013-08-22 12:29:04 -04:00
Tim Abbott c5fcbe103c zephyr_mirror: Handle syncing subs with invite-only streams.
(imported from commit ec8d0c0d13ff0a81fa4a5e1225e94e6dad997356)
2013-08-20 15:02:04 -04:00
Tim Abbott 06d6d14fd7 [manual] Bump API version to 0.2.0.
When we deploy this, we'll need to of course actually build and deploy
the new API tarball.

(imported from commit 03c853e8a9424a63f1c74bb83637d5a1e50a159a)
2013-08-09 15:34:57 -04:00
Waseem Daher b9db604c79 rss-bot: Linkify RSS entry title.
This makes our life a bit nicer if the message is super-long,
because then even when it's "condensed", we still get a link
to the actual article.

(imported from commit 32e70d29cb702ce73f6cd0c04dbc58457cd2e6b5)
2013-08-09 14:09:09 -04:00
Waseem Daher 25f5d240da Fix argument parsing for Twitter bots.
Even though we support a command-line option of --user=,
it gets stored in a field called 'email'.

(imported from commit f2956524517a93187ed182caf8e2d85ccbc1a0f4)
2013-08-09 14:09:09 -04:00
Steve Howell 509c3b4dc3 Send the full first line of the commit message to Zulip.
(imported from commit accafb1cd2fa64ad1377d0fc72ff8f89c1806d3b)
2013-08-09 10:45:20 -04:00
Tim Abbott b4d74b4fbc Rename /usr/local/share/humbug/ to /usr/local/share/zulip/.
(imported from commit 6b5d13b36f96c7174e70ce1391f1d66724c45a62)
2013-08-08 10:22:32 -04:00
Tim Abbott 1fcb389494 Rename Humbug-based variables/paths in twitter search plugin.
(imported from commit a5e1df1f6c58321974c34bacb7515672be55e88e)
2013-08-08 10:22:32 -04:00
Tim Abbott c2acea78cc Rename Humbug-based variables/paths in twitter plugin.
(imported from commit fcb6332d0d1293044f17e841cd78e4f91de5dd30)
2013-08-08 10:22:31 -04:00
Tim Abbott 848e5258c7 Rename Humbug-based variables/paths in rss plugin.
(imported from commit 40b71946752dc323eff8bfe9a03b167bd83c563d)
2013-08-08 10:22:31 -04:00
Tim Abbott f137fa833b Rename Humbug-based variables/paths in jira plugin.
(imported from commit a4596acc5c2d8da5cecad772e9cda5a371189299)
2013-08-08 10:22:31 -04:00
Tim Abbott aba11be192 Rename Humbug-based variables/paths in svn plugin.
(imported from commit 43a9282ad86546fb59e91c36e97a595e51789d07)
2013-08-08 10:22:31 -04:00
Tim Abbott 94f8933b8d Rename Humbug-based variables/paths in git plugin.
(imported from commit e153c7a1a68e82dd3fa45251644be74c62770a9d)
2013-08-08 10:22:31 -04:00
Tim Abbott 53a47e8534 Rename Humbug-based variables/paths in Nagios plugin.
(imported from commit fe8e33241215ea880f7351c3c86b0fb546faf8d3)
2013-08-08 10:22:31 -04:00
Tim Abbott 3005792734 Rename Humbug-based variables in Trac plugin.
(imported from commit 5d406cb6c5fe7b1fbd4da706f7ac6bb6e381cadb)
2013-08-08 10:22:31 -04:00
Tim Abbott 6550134b3e Rename humbug_*_config.py to zulip_*_config.py.
(imported from commit a1d4dd22c59f812f0eb4875dc70c89ce96a4b90c)
2013-08-08 10:22:31 -04:00
Tim Abbott 03293b7be9 Rename humbug-send to zulip-send.
(imported from commit 61400841f8fffe4c706d867aaa012059bcba271d)
2013-08-08 10:22:31 -04:00
Tim Abbott 747a9c536f Rename the 'humbug' API module to 'zulip'.
(imported from commit b3a3d7c05459cbb0110cd0fbe2197d779f3a6264)
2013-08-08 10:22:31 -04:00
Tim Abbott 2ea1bb05a5 Rename ~/.humbugrc to ~/.zuliprc.
(imported from commit a0d53dd20097a56971874dc1d84c6f95267e84f2)
2013-08-08 10:22:31 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Tim Abbott 802b3dc3b2 Add API endpoint to render some message content without sending a message.
(imported from commit e1604b3bf4fc65e958db22f280eba1b5d2ba1e90)
2013-08-01 14:01:58 -04:00
Tim Abbott 102b495609 api: Fix error reporting when result is not JSON.
Previously, we would return a JSONDecodeError to the user in the event
that the server returned a 500 error (or other non-JSON content).

(imported from commit 1624dfec6ac65d34216f4de91e33116a54e414fa)
2013-07-30 16:32:13 -04:00
Scott Feeney 409c495c78 Move API readme to README.md to match GitHub repo
(imported from commit ca30e948c158a4a285bcd002d45725ff13d47cc7)
2013-07-29 16:45:06 -04:00
Tim Abbott 975f4aa59f api: Fix path in send_message example.
(imported from commit 6aab581bf00736986ffcd11042c757eff0c78653)
2013-07-25 17:27:46 -04:00
Tim Abbott 0d077e7f41 [manual] Use api.zulip.com to access the Humbug API.
This needs to be deployed after the nginx configuration is deployed.

(imported from commit 167a3d9d27595d40883bb400ebcc44c4ad9b6a2f)
2013-07-25 17:27:46 -04:00
Tim Abbott 438739f6cc More miscellaneous humbughq.com=>zulip.com updates.
(imported from commit 9a3dbc4268f251c2c0b20d8b6a7e1dc672f1b385)
2013-07-25 17:27:45 -04:00
Tim Abbott bcf86cae98 Switch Humbug users in API examples to zulip.com email addresses.
(imported from commit 83abeafee8d7d146d950c3049568acbf51bb3a12)
2013-07-25 17:19:18 -04:00
Tim Abbott e2a74b0613 api: Fix using staging.humbughq.com as the base_url.
urlparse.urljoin(base_url, url) will drop any path inside base_url if
either the url has a leading "/" or base_url doesn't have a trailing
"/".  So adjust our API bindings to ensure that doesn't happen.

(imported from commit c080ee8c04b89127888609da28afc8b388af1911)
2013-06-28 15:57:28 -04:00
Tim Abbott ea8a80603a [manual] Change API URLs to be based on api.humbughq.com/api.
This must be deployed after we update our running nginx configuration
to serve api.humbughq.com.

(imported from commit b5c34ebdd595f55eecd6dca6a18a37f105107bd5)
2013-06-28 15:57:27 -04:00
Scott Feeney 83cd963c49 Remove unused imports
(imported from commit 9e3050c72a2d1137b9096c6cfa1c3945341b9a56)
2013-06-27 16:22:39 -04:00
Tim Abbott 84b073b05c API: Release several additional API calls to users.
(imported from commit 8b32fa126ab76dc80ee775482a9749dff17edf37)
2013-06-25 16:34:45 -04:00
Tim Abbott 1ec0ee0fd6 [manual] API add_subscriptions: Change arguments to support options.
Since in the future we might want requests to add subscriptions to
include things like colors, in_home_view, etc., we're changing the
data format for the add_subscriptions API call to pass each stream as
a dictionary, giving a convenient place to put any added options.

The manual step required here is updating the API version in AFS
available for use with the zephyr_mirror.py system.

(imported from commit 364960cca582a0658f0d334668822045c001b92c)
2013-06-25 16:34:45 -04:00
Tim Abbott 2a9498dfd3 API: Use humbug.init_from_options in send-message example.
(imported from commit d44cd5fafa565b2f4709714c2777ad9ce513d953)
2013-06-25 16:34:44 -04:00
Tim Abbott ce50812bca API get_members: Return a dictionary of users, not a list of tuples.
I believe this should require no special work on deploy, since some
grepping of logs suggests we are not currently using this API query.

(imported from commit 240086f900c6680cbc90bf6a2f334a9e1f172df6)
2013-06-25 16:34:43 -04:00
Tim Abbott 49a26b9c75 api: Don't require 'https://' in site option.
The --site= option is really only for internal developer use, so I
don't think we gain anything from being strict about it.

(And it doesn't help that the error message one gets pre-this-patch is
super confusing).  Fixes Trac #937.

(imported from commit 8d699982aa6830f9eae2bccd6d0c7a1e0e53dd56)
2013-06-18 14:59:07 -04:00
acrefoot b20eb5621f [api version bump] Update API documentation in the example scripts
Give better examples, and rewrite options parsing to be more consistent across examples.
Make it more obvious that you can use "--user" and "--api-key" with our python examples.

This bumps our python bindings to v0.1.9

(imported from commit 297468088f864b7d585e567dc45523ea681f1856)
2013-06-05 17:34:41 -04:00
Tim Abbott b753eb0c1e [manual] Include the events API in the API tarballs.
Previously our receive API bindings were broken in our API tarballs
because we weren't including the receive API bindings which they used.

This requires our deploying the built API tarball to the prod server
when we deploy it so that the link on /api isn't broken.

(imported from commit 14ecaab34556f4e29c72f4f567d8af73c89d6297)
2013-06-04 15:53:36 -04:00
Jessica McKellar 53de71c0b3 api: bump version to 0.1.7.
(imported from commit 71d1af3806dea82a55ff7f620a92ffb7f1b63a56)
2013-05-29 15:23:26 -04:00
Tim Abbott 880a74eea9 Fix too-long subjects sent by git and nagios integrations
(imported from commit 9bf3af613b07fb7c72125eee0d08fd4a16dfa88a)
2013-05-22 10:17:15 -04:00
Tim Abbott d467a93877 Add support for updating messages after they've been received.
Currently the interface for editing messages is limited to a
command-line API tool; it's great for testing with e.g.:

./api/examples/edit-message --message=348135 --content="test $(date +%s)" --site=http://localhost:9991 --subject="test"

The next commit will add a user interface for actually doing the editing.

(imported from commit bdd408cec2946f31c2292e44f724f96ed5938791)
2013-05-20 23:40:26 -04:00
Luke Faraone 4828c90c64 Implement Humbug SVN integration.
This post-commit hook depends on pysvn. After a transaction is completed,
a Humbug is sent to a configurable stream with the repo modified, actor,
and commit message.

(imported from commit 75cab82d5fe993ea7c4c05be07a7b61e770aff81)
2013-05-01 11:37:07 -07:00
Luke Faraone e3b72155b8 Bump API version
(imported from commit 2366dbabbb0395676bfe7ad908ce362c3aca84c2)
2013-04-18 09:57:54 -07:00
Luke Faraone 8e1268c8fa Update README so as not to lie about min requests version :)
(imported from commit 074adaa6d15014caad83b19f234dd291025fc667)
2013-04-18 09:57:53 -07:00
Zev Benjamin 130c94a2b1 Make the API bindings method for removing subscriptions have the same name we use in our example
(imported from commit de330caa997a02a9122f9d1d9fa0a3891f18f99f)
2013-04-01 13:05:57 -04:00
Zev Benjamin d12a6b8506 Remove the use of "--site" from the example scripts' usage text
Now that we're distributing these examples, we shouldn't be promoting
the use of the "--site" option.

(imported from commit 01ded4a851dc799fa6c7e902e937c4331ed92bf8)
2013-04-01 13:05:57 -04:00
Zev Benjamin a326eb2c48 Fix subscribe/unsubscribe example help text
(imported from commit 886066daa80b377b71b19f992d6733d87bc4d9d3)
2013-04-01 13:05:57 -04:00
Tim Abbott 9d82bb5318 event_queue: Add requests 1.x compatibility.
The previous version of our code only worked with python-requests <
1.0 (as is the case on our servers), the new version will work with
any python-requests new enough to have a .json at all.

(imported from commit 77ffe3e0d890fe88776c313e0e3289aee1bb30ea)
2013-03-29 16:18:37 -04:00
Zev Benjamin c4ed67b2d1 Raise the API polling timeout so it is greater than the heartbeat frequency
(imported from commit 3a6921a9b5c2c9cdf3ce279291de31d4657d9ae0)
2013-03-29 11:11:34 -04:00
Zev Benjamin 25e69b7e86 Add call_on_each_event() to our Python bindings
call_on_each_message() is now implemented in terms of
call_on_each_event().

(imported from commit b4f74ccf46e9cafd9a6ca28dce975492c2d0b29f)
2013-03-28 16:57:48 -04:00
Zev Benjamin cc16746219 Make python bindings use the event system
(imported from commit 5f47054bff4846018f8d606331de104a4ed2de0d)
2013-03-28 16:57:48 -04:00
Luke Faraone b1b88d22d7 Alternatively send request data using "params" if request method is GET
Previously we sent it always as "data", which caused problems for GET
requests where there is no request body.

(imported from commit 20084d1da1b8228cc484536ca4d6f77f547a9d78)
2013-03-28 12:53:42 -07:00
Luke Faraone e0cf6494ed Update API bindings to support new API URIs.
We also switch the Python client to use a client string of "API: Python"
to allow us to determine more easily which bindings our users are using.

(imported from commit 7216c3d150b371835f14d1bc8d81979a92e44925)
2013-03-28 07:59:31 -07:00
Luke Faraone a59d5b9ce6 Use 'Python API' as the API client string
(imported from commit 5c1f8a9c089aaed1c82729f81819b8373d796c2a)
2013-03-28 07:53:37 -07:00
Leo Franchi 6573a4ebb0 Bump API version to 0.1.5
(imported from commit 7c8c66369971e44405219eddac7e8bb3ddb44063)
2013-03-26 18:20:08 -04:00
Leo Franchi 360ded396e Include folders with subfolders when creating api tarball
(imported from commit b9d564a6cc4ee6e2afa0108b6d9f18af039fc8cf)
2013-03-26 18:20:02 -04:00
Leo Franchi dc2d8ece9f Add a groovy file for JIRA integration
(imported from commit 6336206e75389d3f52a868b54bfa79077337a24a)
2013-03-26 14:14:47 -04:00
Waseem Daher 4280affd1f Revert "Special CUSTOMER4 API release."
This reverts commit 47a8590a8b821cb1e2c8930f02a6bfbd42174af1.

(imported from commit fe336cce0bff798e9961ad2a66d942722ebbba86)
2013-03-15 00:27:42 -04:00
Waseem Daher 8ae102a99b Revert "Ship all of our examples in the API update tarball."
This reverts commit 4162114707f69bcfb6ecea95d7bdf4c080b4b168.

(imported from commit a4d68bc2a68209bed8e00e6d58dd5f5d3a3187f9)
2013-03-15 00:27:42 -04:00
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