Enable rc_configtest for patroni

This commit is contained in:
pvk 2022-12-03 20:36:07 +00:00
parent 421ea9308f
commit 03470943b1
4 changed files with 42 additions and 1 deletions

View File

@ -2,6 +2,7 @@ COMMENT = PostgreSQL HA cluster management tool
MODPY_EGG_VERSION = 2.1.5
DISTNAME = patroni-${MODPY_EGG_VERSION}
REVISION = 1
CATEGORIES = databases

View File

@ -102,7 +102,7 @@ postgresql:
- hostssl all all all scram-sha-256
watchdog:
mode: off
mode: "off"
tags:
nofailover: false

View File

@ -0,0 +1,35 @@
* socket.getaddrinfo with "" passed as port on OpenBSD returns error:
[Errno -8] service not supported for ai_socktype
* Add Optional flag where appropriate
Index: patroni/validator.py
--- patroni/validator.py.orig
+++ patroni/validator.py
@@ -42,7 +42,7 @@ def validate_host_port(host_port, listen=False, multip
raise ConfigParseError("expecting '*' alone")
hosts = [p[-1][0] for p in socket.getaddrinfo(None, port, 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)]
for host in hosts:
- proto = socket.getaddrinfo(host, "", 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
+ proto = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
s = socket.socket(proto[0][0], socket.SOCK_STREAM)
try:
if s.connect_ex((host, port)) == 0:
@@ -331,7 +331,7 @@ schema = Schema({
Optional("retry_timeout"): int,
Optional("maximum_lag_on_failover"): int
},
- "pg_hba": [str],
+ Optional("pg_hba"): [str],
"initdb": [Or(str, dict)]
},
Or(*available_dcs): Case({
@@ -370,7 +370,7 @@ schema = Schema({
"postgresql": {
"listen": validate_host_port_listen_multiple_hosts,
"connect_address": validate_connect_address,
- "proxy_address": validate_connect_address,
+ Optional("proxy_address"): validate_connect_address,
"authentication": {
"replication": userattributes,
"superuser": userattributes,

View File

@ -11,4 +11,9 @@ rc_bg=YES
pexp="${MODPY_BIN} ${daemon} ${daemon_flags}"
rc_configtest() {
# use rc_exec here to validate under daemon_user
rc_exec "${daemon} --validate-config ${daemon_flags}"
}
rc_cmd $1