Merge ~cjwatson/launchpad:charm-appserver-nrpe-quote into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 95d38d5721aa5911a6f892dee9bd08bb2c3d49aa
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:charm-appserver-nrpe-quote
Merge into: launchpad:master
Diff against target: 21 lines (+2/-1)
1 file modified
charm/launchpad-appserver/reactive/launchpad-appserver.py (+2/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+439072@code.launchpad.net

Commit message

charm: Quote arguments for nrpe

Description of the change

`NrpeExternalMasterProvides.add_check` just joins the argument list with spaces rather than doing appropriate shell quoting. Cope with this.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

Tested locally and working fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/charm/launchpad-appserver/reactive/launchpad-appserver.py b/charm/launchpad-appserver/reactive/launchpad-appserver.py
2index 2fcc9b6..8f7d514 100644
3--- a/charm/launchpad-appserver/reactive/launchpad-appserver.py
4+++ b/charm/launchpad-appserver/reactive/launchpad-appserver.py
5@@ -1,6 +1,7 @@
6 # Copyright 2022 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9+import shlex
10 import subprocess
11 from multiprocessing import cpu_count
12
13@@ -161,7 +162,7 @@ def nrpe_available(nrpe):
14 "-p",
15 str(config["port_main"]),
16 "-l",
17- "--regex=%s" % healthy_regex,
18+ "--regex=%s" % shlex.quote(healthy_regex),
19 ],
20 name="check_launchpad_appserver",
21 description="Launchpad appserver",

Subscribers

People subscribed via source and target branches

to status/vote changes: