launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29763
[Merge] ~cjwatson/launchpad:charm-appserver-nrpe-quote into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:charm-appserver-nrpe-quote into launchpad:master.
Commit message:
charm: Quote arguments for nrpe
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/439072
`NrpeExternalMasterProvides.add_check` just joins the argument list with spaces rather than doing appropriate shell quoting. Cope with this.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-appserver-nrpe-quote into launchpad:master.
diff --git a/charm/launchpad-appserver/reactive/launchpad-appserver.py b/charm/launchpad-appserver/reactive/launchpad-appserver.py
index 2fcc9b6..8f7d514 100644
--- a/charm/launchpad-appserver/reactive/launchpad-appserver.py
+++ b/charm/launchpad-appserver/reactive/launchpad-appserver.py
@@ -1,6 +1,7 @@
# Copyright 2022 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+import shlex
import subprocess
from multiprocessing import cpu_count
@@ -161,7 +162,7 @@ def nrpe_available(nrpe):
"-p",
str(config["port_main"]),
"-l",
- "--regex=%s" % healthy_regex,
+ "--regex=%s" % shlex.quote(healthy_regex),
],
name="check_launchpad_appserver",
description="Launchpad appserver",