zulip/scripts/lib
Alex Vandiver 0da62e7cda supervisor: Retry, with backoff, to connect to supervisor socket.
If `zulip-puppet-apply` is run during an upgrade, it will immediately
try to re-`stop-server` before running migrations; if the last step in
the puppet application was to restart `supervisor`, it may not be
listening on its UNIX socket yet.  In such cases, `socket.connect()`
throws a `FileNotFoundError`:

```
Traceback (most recent call last):
  File "./scripts/stop-server", line 53, in <module>
    services = list_supervisor_processes(services, only_running=True)
  File "./scripts/lib/supervisor.py", line 34, in list_supervisor_processes
    processes = rpc().supervisor.getAllProcessInfo()
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1456, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1160, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1172, in single_request
    http_conn = self.send_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1285, in send_request
    self.send_content(connection, request_body)
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1315, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 950, in send
    self.connect()
  File "./scripts/lib/supervisor.py", line 10, in connect
    self.sock.connect(self.host)
FileNotFoundError: [Errno 2] No such file or directory
```

Catch the `FileNotFoundError` and retry twice more, with backoff.  If
it fails repeatedly, point to `service supervisor status` for further
debugging, as `FileNotFoundError` is rather misleading -- the file
exists, it simply is not accepting connections.
2023-05-12 13:14:27 -07:00
..
__init__.py
build-pgroonga scripts: Pass --retry 3 to curl. 2022-11-08 08:07:36 -08:00
check-database-compatibility check-database-compatibility: Drop .py from script name. 2023-03-03 18:02:37 -08:00
check_rabbitmq_queue.py python: Use ‘not in’ for negated membership tests 2022-09-17 11:48:33 -07:00
clean_emoji_cache.py python: Reformat with Black, except quotes. 2021-02-12 13:11:19 -08:00
clean_node_cache.py dependencies: Switch to pnpm. 2023-03-20 15:48:29 -07:00
clean_unused_caches.py dependencies: Switch to pnpm. 2023-03-20 15:48:29 -07:00
clean_venv_cache.py requirements: Remove Thumbor. 2021-05-06 20:07:32 -07:00
create-production-venv python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
email-mirror-postfix ruff: Fix RUF004 exit() is only available in the interpreter. 2022-12-04 22:11:24 -08:00
fix-standalone-certbot puppet: Fix standalone certbot configurations. 2022-01-24 12:13:44 -08:00
hash_reqs.py python: Convert last type comments to annotations. 2022-03-24 20:32:39 -07:00
install puppet: Add PostgreSQL 15 support. 2023-05-10 14:06:02 -07:00
install-node install: Use set -x when installing node, shellcheck, shfmt, tx. 2023-05-10 12:15:34 -07:00
node_cache.py node_cache: Disable pnpm update check. 2023-05-02 12:29:38 -07:00
puppet_cache.py puppet: Pin with sha256sum verification. 2023-02-28 00:04:39 -05:00
pythonrc.py ruff: Fix M001 Unused `noqa` directive. 2022-11-03 12:10:15 -07:00
queue_workers.py python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
setup-apt-repo setup-apt-repo: Make hashes file not contain full path. 2022-03-12 17:24:19 -08:00
setup-yum-repo provision: Add support for Fedora 34. 2021-07-20 12:10:41 -07:00
setup_path.py ruff: Enable new lints DTZ, ISC, PIE, PLW, Q, S, SIM. 2023-01-04 16:25:07 -08:00
setup_venv.py install-node: Upgrade Node.js to 18.14.0; manage Yarn with Corepack. 2023-02-09 15:50:47 -08:00
sharding.py black: Reformat with Black 23. 2023-02-02 10:40:13 -08:00
supervisor.py supervisor: Retry, with backoff, to connect to supervisor socket. 2023-05-12 13:14:27 -07:00
unpack-zulip python: Normalize quotes with Black. 2021-02-12 13:11:19 -08:00
update-git-upstream upgrade-zulip-from-git: Extract code to set zulip upstream remote. 2023-04-19 16:56:14 -07:00
upgrade-zulip python: Replace universal_newlines with text. 2022-01-23 22:16:01 -08:00
upgrade-zulip-from-git upgrade-zulip-from-git: CWD will be the cache directory. 2023-04-24 17:19:27 -07:00
upgrade-zulip-stage-2 install: Remove PostgreSQL 11 support. 2023-05-05 13:35:32 -07:00
warn-rabbitmq-nodename-change puppet: Always set the RabbitMQ nodename to zulip@localhost. 2022-01-25 01:48:02 +00:00
zulip_tools.py zulip_tools: Add a get_config_bool to match Puppet logic. 2023-05-11 15:54:15 -07:00