Skip to content

Commit 8528a6e

Browse files
committed
refactor(tools): rename check2basket to build-basket and remove-uuids to basket-remove-uuids
Two renames to bring the `tools/` directory onto a more consistent naming scheme (four prefix groups: `run-*`, `build-*`, `update-*`, `basket-*`): - `check2basket` -> `build-basket`. Only one basket is built per invocation, so the singular form matches what the tool actually produces. The new name also groups it with `build-docs` as the two "generate an artifact from scratch" entries. - `remove-uuids` -> `basket-remove-uuids`. The old name left the "what uuids?" question unanswered and did not cluster with the other `basket-*` helpers in `ls tools/`. The new name is explicit about the object it operates on and matches `basket-compare` / `basket-join`. Also update the DESCRIPTION strings in both tools (the old basket-remove-uuids docstring was a stale copy of basket-join's) and update the user-facing references in CONTRIBUTING.md, ICINGA.md and the CHANGELOG Unreleased section. Historical CHANGELOG entries under earlier release headings are left alone so the release notes still reflect the names in use at the time of those releases. Follow-up commits will modernise the test-runner, doc and basket tools themselves (swap to `tools/_common.py`, drop the optional colorama dependency, unify the argparse / module docstring / version header).
1 parent 736bfd0 commit 8528a6e

File tree

5 files changed

+37
-21
lines changed

5 files changed

+37
-21
lines changed

CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Grafana:
7676

7777
Icinga Director:
7878

79-
* Service Templates: the "Notes URL" field now opens the rendered plugin page on <https://linuxfabrik.github.io/monitoring-plugins/> instead of the raw source listing on GitHub; regenerate your basket with `tools/check2basket --auto` to pick up the new URL
79+
* Service Templates: the "Notes URL" field now opens the rendered plugin page on <https://linuxfabrik.github.io/monitoring-plugins/> instead of the raw source listing on GitHub; regenerate your basket with `tools/build-basket --auto` to pick up the new URL
8080

8181

8282
Monitoring Plugins:
@@ -104,6 +104,11 @@ Monitoring Plugins:
104104
* updates: adapt to updated powershell.py library
105105

106106

107+
Tools:
108+
109+
* rename `tools/check2basket` to `tools/build-basket` (one basket is built per run, so the singular name matches what the tool does) and `tools/remove-uuids` to `tools/basket-remove-uuids` (prefix-group consistency with `basket-compare` / `basket-join`). Update any scripts, wrappers or documentation that invoked the old names.
110+
111+
107112
### Removed
108113

109114
Monitoring Plugins:
@@ -126,9 +131,9 @@ Build, CI/CD:
126131

127132
Tools:
128133

129-
* check2basket: fix missing `importlib.machinery` and `importlib.util` imports
130-
* check2basket: strip argparse `%%` escaping in Icinga Director basket descriptions
131-
* check2basket: write `[]` as default value for `append` parameters with `default=None` in the Icinga Director basket
134+
* build-basket (formerly `check2basket`): fix missing `importlib.machinery` and `importlib.util` imports
135+
* build-basket (formerly `check2basket`): strip argparse `%%` escaping in Icinga Director basket descriptions
136+
* build-basket (formerly `check2basket`): write `[]` as default value for `append` parameters with `default=None` in the Icinga Director basket
132137

133138

134139
Grafana:

CONTRIBUTING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Checklist:
119119
* Optional: `unit-test/run` - the unittest file (see [Unit Tests](#unit-tests))
120120
* Optional: `requirements.txt`
121121
* If providing performance data: Grafana dashboard (see [GRAFANA](https://github.com/Linuxfabrik/monitoring-plugins/blob/main/GRAFANA.md)) and `.ini` file for the Icinga Web 2 Grafana Module
122-
* Icinga Director Basket Config for the check plugin (`check2basket`)
122+
* Icinga Director Basket Config for the check plugin (`build-basket`)
123123
* Icinga Service Set in `all-the-rest.json`
124124
* Optional: sudoers file (see [sudoers File](#sudoers-file))
125125
* Optional: A screenshot of the plugins' output from within Icinga, resized to 423x106, using background-color `#f5f9fa`, hosted on [download.linuxfabrik.ch](https://download.linuxfabrik.ch/monitoring-plugins/assets/screenshots/), and listed alphabetically in the projects [README](https://github.com/Linuxfabrik/monitoring-plugins/blob/main/README.md).
@@ -979,7 +979,7 @@ If the plugin requires `sudo`-permissions to run, please add the plugin to the `
979979

980980
Each plugin should provide its required Director config in form of a Director basket. The basket usually contains at least one Command, one Service Template and some associated Datafields. The rest of the Icinga Director configuration (Host Templates, Service Sets, Notification Templates, Tag Lists, etc) can be placed in the `assets/icingaweb2-module-director/all-the-rest.json` file.
981981

982-
The Icinga Director Basket for one or all plugins can be created using the `check2basket` tool.
982+
The Icinga Director Basket for one or all plugins can be created using the `build-basket` tool.
983983

984984
> **Always review the basket before committing.**
985985
@@ -989,7 +989,7 @@ The Icinga Director Basket for one or all plugins can be created using the `chec
989989
After writing a new check called `new-check`, generate a basket file using:
990990

991991
```bash
992-
./tools/check2basket --plugin-file check-plugins/new-check/new-check
992+
./tools/build-basket --plugin-file check-plugins/new-check/new-check
993993
```
994994

995995
The basket will be saved as `check-plugins/new-check/icingaweb2-module-director/new-check.json`. Inspect the basket, paying special attention to:
@@ -1004,7 +1004,7 @@ The basket will be saved as `check-plugins/new-check/icingaweb2-module-director/
10041004

10051005
#### Fine-tune a Basket File
10061006

1007-
**Never directly edit a basket JSON file.** If adjustments must be made to the basket, create a YML/YAML config file for `check2basket`.
1007+
**Never directly edit a basket JSON file.** If adjustments must be made to the basket, create a YML/YAML config file for `build-basket`.
10081008

10091009
For example, to set the timeout to 30s, to enable notifications and some other options, the config in `check-plugins/new-check/icingaweb2-module-director/new-check.yml` should look as follows:
10101010

@@ -1026,18 +1026,18 @@ overwrites:
10261026
'["ServiceTemplate"]["tpl-service-new-check"]["vars"]["criticality"]': 'C'
10271027
```
10281028
1029-
Then, re-run `check2basket` to apply the overwrites:
1029+
Then, re-run `build-basket` to apply the overwrites:
10301030

10311031
```bash
1032-
./tools/check2basket --plugin-file check-plugins/new-check/new-check
1032+
./tools/build-basket --plugin-file check-plugins/new-check/new-check
10331033
```
10341034

1035-
If a parameter was added, changed or deleted in the plugin, simply re-run the `check2basket` to update the basket file.
1035+
If a parameter was added, changed or deleted in the plugin, simply re-run the `build-basket` to update the basket file.
10361036

10371037

10381038
#### Basket File for different OS
10391039

1040-
The `check2basket` tool also offers to generate so-called `variants` of the checks (different flavours of the check command call to run on different operating systems):
1040+
The `build-basket` tool also offers to generate so-called `variants` of the checks (different flavours of the check command call to run on different operating systems):
10411041

10421042
* `linux`: This is the default, and will be used if no other variant is defined. It generates a `cmd-check-...`, `tpl-service-...` and the associated datafields.
10431043
* `windows`: Generates a `cmd-check-...-windows`, `cmd-check-...-windows-python`, `tpl-service-...-windows` and the associated datafields.
@@ -1058,10 +1058,10 @@ variants:
10581058

10591059
#### Create Basket Files for all Check Plugins
10601060

1061-
To run `check2basket` against all checks, for example due to a change in the `check2basket` script itself, use:
1061+
To run `build-basket` against all checks, for example due to a change in the `build-basket` script itself, use:
10621062

10631063
```bash
1064-
./tools/check2basket --auto
1064+
./tools/build-basket --auto
10651065
```
10661066

10671067

ICINGA.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Create the Icinga Director Basket JSON file:
6060

6161
```bash
6262
./tools/basket-join
63-
./tools/remove-uuids \
63+
./tools/basket-remove-uuids \
6464
--input-file icingaweb2-module-director-basket.json \
6565
--output-file icingaweb2-module-director-basket-no-uuids.json
6666
```
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ except ImportError:
2020
colorama = False
2121

2222
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
23-
__version__ = '2026040801'
24-
25-
DESCRIPTION = 'A tool to join icingaweb2 director baskets (with or without uuids).'
23+
__version__ = '2026041301'
24+
25+
DESCRIPTION = (
26+
'Strip the `uuid` fields from an Icinga Director basket JSON so it can '
27+
'be imported into a Director that uses the upstream schema. Linuxfabrik '
28+
'uses a forked Director that keeps uuids; the upstream version does not, '
29+
'and rejects imports that contain them.'
30+
)
2631

2732

2833
skip_plugins = [
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ except ImportError:
2828
colorama = False
2929

3030
__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
31-
__version__ = '2026041201'
32-
33-
DESCRIPTION = 'A tool to generate Icinga Director baskets from a check plugin.'
31+
__version__ = '2026041301'
32+
33+
DESCRIPTION = (
34+
'Generate an Icinga Director basket JSON from a check plugin. Walks '
35+
'the plugin`s argparse definition, turns each parameter into a Director '
36+
'datafield, emits a command and service-template pair, and writes the '
37+
'result into the plugin`s `icingaweb2-module-director/` subdirectory. '
38+
'Use `--auto` to regenerate baskets for every plugin in the repo.'
39+
)
3440

3541
DEFAULT_VARIANTS = [
3642
'linux',

0 commit comments

Comments
 (0)