Source: patroni
Version: 1.6.4-1
Severity: minor
Tags: patch

When parsing `pg_lsclusters` output, `pg_createconfig_patroni` does:

    PORT=$(($(pg_lsclusters | awk '{print $3}' | grep -v Port | sort -n | tail 
-1) + 1))

if for whatever reason a cluster status line will contain the string
`Port`, then that line will be filtered out.

I instead suggest to do:

    PORT=$(($(pg_lsclusters | tail -n +2 | awk '{print $3}' | sort -n | tail 
-1) + 1))

`tail -n +2` will output all lines starting from line 2 on (line
numbering starts at 1), thus omitting the "table header".

-- System Information:
Debian Release: 10.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-8-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_CH.utf8, LC_CTYPE=de_CH.utf8 (charmap=UTF-8), LANGUAGE=de_CH:de 
(charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to