Skip to content

Commit 32d6838

Browse files
committed
fix(check2basket): strip argparse %% escaping in Icinga Director basket descriptions
1 parent 8776554 commit 32d6838

6 files changed

Lines changed: 10 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Build, CI/CD:
9595
Tools:
9696

9797
* check2basket: fix missing `importlib.machinery` and `importlib.util` imports
98+
* check2basket: strip argparse `%%` escaping in Icinga Director basket descriptions
9899
* check2basket: write `[]` as default value for `append` parameters with `default=None` in the Icinga Director basket
99100

100101

check-plugins/deb-updates/icingaweb2-module-director/deb-updates.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"3": {
133133
"varname": "deb_updates_query",
134134
"caption": "Deb Updates: Query",
135-
"description": "The list of available updates and upgrades is stored in a SQL table. Provide the SQL `WHEN` statement part to narrow down results. Example: `--query='package like \"bind9-%%\"'`. Also supports regular expressions via a REGEXP statement. Have a look at the README for a list of available columns. If this parameter is used, a list of matching updates is printed.",
135+
"description": "The list of available updates and upgrades is stored in a SQL table. Provide the SQL `WHEN` statement part to narrow down results. Example: `--query='package like \"bind9-%\"'`. Also supports regular expressions via a REGEXP statement. Have a look at the README for a list of available columns. If this parameter is used, a list of matching updates is printed.",
136136
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
137137
"format": null,
138138
"settings": {

check-plugins/disk-usage/icingaweb2-module-director/disk-usage.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@
349349
"2": {
350350
"varname": "disk_usage_critical",
351351
"caption": "Disk Usage: Critical",
352-
"description": "Critical threshold, of the form \"<number>[unit][method]\", where unit is one of `%%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95%% usage or more. `9.5M` = alert when 9.5 MiB or more is used. Other self-explanatory examples are `95%%USED`, `5%%FREE`, `9.5GFREE`, `1400GUSED`.",
352+
"description": "Critical threshold, of the form \"<number>[unit][method]\", where unit is one of `%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95% usage or more. `9.5M` = alert when 9.5 MiB or more is used. Other self-explanatory examples are `95%USED`, `5%FREE`, `9.5GFREE`, `1400GUSED`.",
353353
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
354354
"format": null,
355355
"settings": {
@@ -435,7 +435,7 @@
435435
"10": {
436436
"varname": "disk_usage_warning",
437437
"caption": "Disk Usage: Warning",
438-
"description": "Warning threshold, of the form \"<number>[unit][method]\", where unit is one of `%%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95%% usage. `9.5M` = alert when 9.5 MiB is used. Other self-explanatory examples are `95%%USED`, `5%%FREE`, `9.5GFREE`, `1400GUSED`.",
438+
"description": "Warning threshold, of the form \"<number>[unit][method]\", where unit is one of `%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95% usage. `9.5M` = alert when 9.5 MiB is used. Other self-explanatory examples are `95%USED`, `5%FREE`, `9.5GFREE`, `1400GUSED`.",
439439
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
440440
"format": null,
441441
"settings": {
@@ -455,7 +455,7 @@
455455
"12": {
456456
"varname": "disk_usage_windows_critical",
457457
"caption": "Disk Usage: Critical",
458-
"description": "Critical threshold, of the form \"<number>[unit][method]\", where unit is one of `%%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95%% usage or more. `9.5M` = alert when 9.5 MiB or more is used. Other self-explanatory examples are `95%%USED`, `5%%FREE`, `9.5GFREE`, `1400GUSED`.",
458+
"description": "Critical threshold, of the form \"<number>[unit][method]\", where unit is one of `%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95% usage or more. `9.5M` = alert when 9.5 MiB or more is used. Other self-explanatory examples are `95%USED`, `5%FREE`, `9.5GFREE`, `1400GUSED`.",
459459
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
460460
"format": null,
461461
"settings": {
@@ -541,7 +541,7 @@
541541
"20": {
542542
"varname": "disk_usage_windows_warning",
543543
"caption": "Disk Usage: Warning",
544-
"description": "Warning threshold, of the form \"<number>[unit][method]\", where unit is one of `%%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95%% usage. `9.5M` = alert when 9.5 MiB is used. Other self-explanatory examples are `95%%USED`, `5%%FREE`, `9.5GFREE`, `1400GUSED`.",
544+
"description": "Warning threshold, of the form \"<number>[unit][method]\", where unit is one of `%|K|M|G|T|P` and method is one of `USED|FREE`. If \"unit\" is omitted, `%` is assumed. `K` means `kibibyte` etc. If \"method\" is omitted, `USED` is assumed. `USED` means \"number ore more\", `FREE` means \"number or less\". Examples: `95` = alert at 95% usage. `9.5M` = alert when 9.5 MiB is used. Other self-explanatory examples are `95%USED`, `5%FREE`, `9.5GFREE`, `1400GUSED`.",
545545
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
546546
"format": null,
547547
"settings": {

check-plugins/kubectl-get-pods/icingaweb2-module-director/kubectl-get-pods.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
"4": {
165165
"varname": "kubectl_get_pods_query",
166166
"caption": "Kubectl Get Pods: Query",
167-
"description": "Provide the SQL `WHEN` statement part to narrow down results. Example: `namespace = 'mynamespace' and name like 'prod-%%' and status != 'running'`. Have a look at the README for a list of available columns.",
167+
"description": "Provide the SQL `WHEN` statement part to narrow down results. Example: `namespace = 'mynamespace' and name like 'prod-%' and status != 'running'`. Have a look at the README for a list of available columns.",
168168
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
169169
"format": null,
170170
"settings": {

check-plugins/rpm-updates/icingaweb2-module-director/rpm-updates.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"3": {
133133
"varname": "rpm_updates_query",
134134
"caption": "RPM Updates: Query",
135-
"description": "The list of available updates and upgrades is stored in a SQL table. Provide the SQL `WHEN` statement part to narrow down results. Example: `--query='package like \"bind9-%%\"'`. Also supports regular expressions via a REGEXP statement. Have a look at the README for a list of available columns. If this parameter is used, a list of matching updates is printed.",
135+
"description": "The list of available updates and upgrades is stored in a SQL table. Provide the SQL `WHEN` statement part to narrow down results. Example: `--query='package like \"bind9-%\"'`. Also supports regular expressions via a REGEXP statement. Have a look at the README for a list of available columns. If this parameter is used, a list of matching updates is printed.",
136136
"datatype": "Icinga\\Module\\Director\\DataType\\DataTypeString",
137137
"format": null,
138138
"settings": {

tools/check2basket

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ except ImportError:
2626
colorama = False
2727

2828
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
29-
__version__ = '2025111201'
29+
__version__ = '2026040701'
3030

3131
DESCRIPTION = 'A tool to generate Icinga Director baskets from a check plugin.'
3232

@@ -168,6 +168,7 @@ def get_varname(check, param):
168168
def help2description(help_text):
169169
help_text = re.sub(r' Default:.*%\(default\)s.*$', '', help_text)
170170
help_text = re.sub(r'\n\s*', ' ', help_text)
171+
help_text = help_text.replace('%%', '%')
171172
return help_text
172173

173174

0 commit comments

Comments
 (0)