diff --git a/bots/check-mirroring b/api/integrations/zephyr/check-mirroring similarity index 100% rename from bots/check-mirroring rename to api/integrations/zephyr/check-mirroring diff --git a/bots/process_ccache b/api/integrations/zephyr/process_ccache similarity index 94% rename from bots/process_ccache rename to api/integrations/zephyr/process_ccache index bc0b718830..0badf2db58 100755 --- a/bots/process_ccache +++ b/api/integrations/zephyr/process_ccache @@ -18,7 +18,7 @@ open(api_key_path, "w").write(api_key + "\n") # Setup supervisord configuration supervisor_path = "/etc/supervisor/conf.d/%s.conf" % (program_name,) -template = "/home/zulip/zulip/bots/zmirror_private.conf.template" +template = "/home/zulip/zulip/api/integrations/zephyr/zmirror_private.conf.template" template_data = open(template).read() session_path = "/home/zulip/zephyr_sessions/%s" % (program_name,) diff --git a/bots/sync-public-streams b/api/integrations/zephyr/sync-public-streams similarity index 100% rename from bots/sync-public-streams rename to api/integrations/zephyr/sync-public-streams diff --git a/bots/zephyr_mirror.py b/api/integrations/zephyr/zephyr_mirror.py similarity index 100% rename from bots/zephyr_mirror.py rename to api/integrations/zephyr/zephyr_mirror.py diff --git a/bots/zephyr_mirror_backend.py b/api/integrations/zephyr/zephyr_mirror_backend.py similarity index 100% rename from bots/zephyr_mirror_backend.py rename to api/integrations/zephyr/zephyr_mirror_backend.py diff --git a/bots/zmirror-renew-kerberos b/api/integrations/zephyr/zmirror-renew-kerberos similarity index 100% rename from bots/zmirror-renew-kerberos rename to api/integrations/zephyr/zmirror-renew-kerberos diff --git a/bots/zmirror_private.conf.template b/api/integrations/zephyr/zmirror_private.conf.template similarity index 62% rename from bots/zmirror_private.conf.template rename to api/integrations/zephyr/zmirror_private.conf.template index 97c6ee4043..83545e350f 100644 --- a/bots/zmirror_private.conf.template +++ b/api/integrations/zephyr/zmirror_private.conf.template @@ -1,5 +1,5 @@ [program:zmirror-USERNAME] -command=/home/zulip/zulip/bots/zephyr_mirror_backend.py --root-path=/home/zulip/zulip --user=USERNAME --log-path=/home/zulip/logs/mirror-log-%(program_name)s --use-sessions --session-path=/home/zulip/zephyr_sessions/%(program_name)s --api-key-file=/home/zulip/api-keys/%(program_name)s --ignore-expired-tickets --nagios-path=/home/zulip/mirror_status/%(program_name)s --nagios-class=zulip-mirror-nagios --site=https://zephyr.zulipchat.com +command=/home/zulip/zulip/api/integrations/zephyr/zephyr_mirror_backend.py --root-path=/home/zulip/zulip --user=USERNAME --log-path=/home/zulip/logs/mirror-log-%(program_name)s --use-sessions --session-path=/home/zulip/zephyr_sessions/%(program_name)s --api-key-file=/home/zulip/api-keys/%(program_name)s --ignore-expired-tickets --nagios-path=/home/zulip/mirror_status/%(program_name)s --nagios-class=zulip-mirror-nagios --site=https://zephyr.zulipchat.com priority=200 ; the relative start priority (default 999) autostart=true ; start at supervisord start (default: true) autorestart=true ; whether/when to restart (default: unexpected) diff --git a/puppet/zulip_ops/files/cron.d/zephyr-mirror b/puppet/zulip_ops/files/cron.d/zephyr-mirror index 0aa50e8625..762960b2c6 100644 --- a/puppet/zulip_ops/files/cron.d/zephyr-mirror +++ b/puppet/zulip_ops/files/cron.d/zephyr-mirror @@ -22,5 +22,5 @@ SHELL=/bin/bash # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command -35 * * * * zulip /home/zulip/zulip/bots/zmirror-renew-kerberos -*/2 * * * * zulip /home/zulip/zulip/bots/check-mirroring --sharded &> /var/lib/nagios_state/check-mirroring-results-tmp; mv /var/lib/nagios_state/check-mirroring-results-tmp /var/lib/nagios_state/check-mirroring-results +35 * * * * zulip /home/zulip/zulip/api/integrations/zephyr/zmirror-renew-kerberos +*/2 * * * * zulip /home/zulip/zulip/api/integrations/zephyr/check-mirroring --sharded &> /var/lib/nagios_state/check-mirroring-results-tmp; mv /var/lib/nagios_state/check-mirroring-results-tmp /var/lib/nagios_state/check-mirroring-results diff --git a/puppet/zulip_ops/files/munin-plugins/humbug_send_receive b/puppet/zulip_ops/files/munin-plugins/humbug_send_receive index 0dd5b6573a..60912194f9 100755 --- a/puppet/zulip_ops/files/munin-plugins/humbug_send_receive +++ b/puppet/zulip_ops/files/munin-plugins/humbug_send_receive @@ -4,4 +4,4 @@ if [ "$(hostname)" = "staging.zulip.net" ]; then else site="https://api.zulip.com" fi -/home/zulip/deployments/current/bots/check_send_receive.py --munin "$1" --site="$site" +/home/zulip/deployments/current/api/integrations/zephyr/check_send_receive.py --munin "$1" --site="$site" diff --git a/puppet/zulip_ops/files/nagios3/commands.cfg b/puppet/zulip_ops/files/nagios3/commands.cfg index b262c3df03..d7a20ee0c0 100644 --- a/puppet/zulip_ops/files/nagios3/commands.cfg +++ b/puppet/zulip_ops/files/nagios3/commands.cfg @@ -98,7 +98,7 @@ define command{ define command{ command_name check_sync_public_streams - command_line /usr/lib/nagios/plugins/check_by_ssh -p $ARG1$ -l nagios -t 30 -i /var/lib/nagios/.ssh/id_rsa -H $HOSTADDRESS$ -C '/usr/lib/nagios/plugins/check_procs -u zulip -c 1:1 -a "/home/zulip/zulip/bots/sync-public-streams"' + command_line /usr/lib/nagios/plugins/check_by_ssh -p $ARG1$ -l nagios -t 30 -i /var/lib/nagios/.ssh/id_rsa -H $HOSTADDRESS$ -C '/usr/lib/nagios/plugins/check_procs -u zulip -c 1:1 -a "/home/zulip/zulip/api/integrations/zephyr/sync-public-streams"' } define command{ diff --git a/puppet/zulip_ops/files/nagios_plugins/zulip_zephyr_mirror/check_zephyr_mirror b/puppet/zulip_ops/files/nagios_plugins/zulip_zephyr_mirror/check_zephyr_mirror index 3860570c01..1ccaf5a502 100755 --- a/puppet/zulip_ops/files/nagios_plugins/zulip_zephyr_mirror/check_zephyr_mirror +++ b/puppet/zulip_ops/files/nagios_plugins/zulip_zephyr_mirror/check_zephyr_mirror @@ -4,9 +4,10 @@ Nagios plugin to check that Zephyr mirror forwarding is running. This script just checks the contents of a file. The forwarding test -itself lives in api/bots/check-mirroring and should be run out of cron. +itself lives in api/integrations/zephyr/check-mirroring and should be +run out of cron. -See bots/zephyr-mirror-crontab for the crontab details. +See puppet/zulip_ops/files/cron.d/zephyr-mirror for the crontab details. """ from __future__ import print_function if False: diff --git a/puppet/zulip_ops/files/supervisor/conf.d/zmirror.conf b/puppet/zulip_ops/files/supervisor/conf.d/zmirror.conf index 9f0704b61b..f88e0e4d7c 100644 --- a/puppet/zulip_ops/files/supervisor/conf.d/zmirror.conf +++ b/puppet/zulip_ops/files/supervisor/conf.d/zmirror.conf @@ -1,5 +1,5 @@ [program:zmirror] -command=/home/zulip/zulip/bots/zephyr_mirror.py --root-path=/home/zulip/ --user=tabbott/extra --forward-class-messages --log-path=/home/zulip/logs/mirror-log --on-startup-command="/home/zulip/zulip/bots/zmirror-renew-kerberos" +command=/home/zulip/zulip/api/integrations/zephyr/zephyr_mirror.py --root-path=/home/zulip/ --user=tabbott/extra --forward-class-messages --log-path=/home/zulip/logs/mirror-log --on-startup-command="/home/zulip/zulip/api/integrations/zephyr/zmirror-renew-kerberos" priority=200 ; the relative start priority (default 999) autostart=true ; start at supervisord start (default: true) autorestart=true ; whether/when to restart (default: unexpected) @@ -11,7 +11,7 @@ stdout_logfile=/var/log/zulip/zmirror.log ; stdout log path, NONE for no environment=HOME="/home/zulip",USER="zulip" [program:sync-public-streams] -command=/home/zulip/zulip/bots/sync-public-streams +command=/home/zulip/zulip/api/integrations/zephyr/sync-public-streams priority=200 ; the relative start priority (default 999) autostart=true ; start at supervisord start (default: true) autorestart=true ; whether/when to restart (default: unexpected) diff --git a/puppet/zulip_ops/manifests/nagios.pp b/puppet/zulip_ops/manifests/nagios.pp index fbc100d272..eee3b5c91a 100644 --- a/puppet/zulip_ops/manifests/nagios.pp +++ b/puppet/zulip_ops/manifests/nagios.pp @@ -80,7 +80,7 @@ class zulip_ops::nagios { mode => 644, owner => "root", group => "root", - source => '/root/zulip/bots/zuliprc.nagios', + source => '/root/zulip/api/integrations/zephyr/zuliprc.nagios', } exec { "fix_nagios_permissions": diff --git a/tools/run-mypy b/tools/run-mypy index a3268f3641..ece89d9f11 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -36,7 +36,7 @@ exclude_common += ['contrib_bots/bots'] exclude_py2 = [] # type: List[str] exclude_py3 = """ -bots/process_ccache +api/integrations/zephyr/process_ccache """.split() parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.") diff --git a/zerver/tests/test_zephyr.py b/zerver/tests/test_zephyr.py index ad5759ea30..5c4dbe6c59 100644 --- a/zerver/tests/test_zephyr.py +++ b/zerver/tests/test_zephyr.py @@ -71,7 +71,7 @@ class ZephyrTest(ZulipTestCase): 'ssh', 'server', '--', - '/home/zulip/zulip/bots/process_ccache', + '/home/zulip/zulip/api/integrations/zephyr/process_ccache', 'starnine', get_user(email, realm).api_key, 'MTIzNA==']) @@ -98,7 +98,7 @@ class ZephyrTest(ZulipTestCase): 'ssh', 'server', '--', - '/home/zulip/zulip/bots/process_ccache', + '/home/zulip/zulip/api/integrations/zephyr/process_ccache', 'starnine', get_user(email, realm).api_key, 'MTIzNA==']) diff --git a/zerver/views/zephyr.py b/zerver/views/zephyr.py index 0dbb68eab8..8f704148d7 100644 --- a/zerver/views/zephyr.py +++ b/zerver/views/zephyr.py @@ -47,7 +47,7 @@ def webathena_kerberos_login(request, user_profile, # TODO: Send these data via (say) rabbitmq try: subprocess.check_call(["ssh", settings.PERSONAL_ZMIRROR_SERVER, "--", - "/home/zulip/zulip/bots/process_ccache", + "/home/zulip/zulip/api/integrations/zephyr/process_ccache", force_str(user), force_str(user_profile.api_key), force_str(base64.b64encode(ccache))])