]> git.proxmox.com Git - pmg-api.git/commit
adapt journalctl invocation to buster
authorStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 9 Aug 2019 07:07:30 +0000 (09:07 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 9 Aug 2019 10:11:21 +0000 (12:11 +0200)
commit16ad07862845e1246f5a16a9022486fd81fc4806
treeb2de5f60c74bf84916ae1503661574821bb328b5
parent8b1f3b4dbbb51ba02baf88a5cb6b5308f33f7088
adapt journalctl invocation to buster

With Debian Buster the behavior of `journalctl` has changed when it finds
no entries for a given selection:
* The exit code was 0 in stretch, but is 1 in buster
* The output changed slightly - a header got added

Since PMG::Utils::scan_journal_for_rbl_rejects uses journalctl for reading the
IPs blocked by postscreen it needs to adapt for the new behavior (otherwise
run_command dies because of the exit code 1)

The patch addresses the problem by using the json-output of `journalctl`, which
still exits with 0 if no entries are present . Additionally the json-output
adds the current cursor to the output by default, removing the need to
explicitly scanning for it.(the exit code of 1 was due to '--show-cursor'
without a single result line).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/Utils.pm