puppet: Remove dependency on scripts.lib.zulip_tools.

ab130ceb35 added a dependency on scripts.lib.zulip_tools; however,
check_postgresql_replication_lag is run on hosts which do not have a
zulip tree installed.

Inline the simple functions that were imported.
This commit is contained in:
Alex Vandiver 2021-06-07 23:29:08 -07:00 committed by Tim Abbott
parent 71b56f7c1c
commit 20eab264cf
1 changed files with 15 additions and 2 deletions

View File

@ -4,14 +4,27 @@
replica PostgreSQL servers' xlog location. Requires that the user this
connects to PostgreSQL as has been granted the `pg_monitor` role.
This can only use stdlib modules from python.
"""
import configparser
import re
import subprocess
from typing import Dict, List
from scripts.lib.zulip_tools import get_config, get_config_file
config_file = get_config_file()
def get_config(
config_file: configparser.RawConfigParser,
section: str,
key: str,
default_value: str = "",
) -> str:
if config_file.has_option(section, key):
return config_file.get(section, key)
return default_value
config_file = configparser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")
states = {
"OK": 0,