Skip to content

SystemdParameter: block parameter do not need [], add passOnNotFound to make audit succeed if no value is found #1258

Merged
kkanas merged 2 commits intodevfrom
kkanas/fix-systemdparameter-arg-block
Mar 24, 2026
Merged

SystemdParameter: block parameter do not need [], add passOnNotFound to make audit succeed if no value is found #1258
kkanas merged 2 commits intodevfrom
kkanas/fix-systemdparameter-arg-block

Conversation

@kkanas
Copy link
Copy Markdown
Contributor

@kkanas kkanas commented Mar 18, 2026

Description

SystemdParameter: block parameter do not need [], add passOnNotFound to make audit succeed if no value is found (aka default is ok but we have no way of checking it)

Describe your changes in as much detail as possible. Provide a link/reference to the issue solved with this request if any.

Checklist

  • I have read the contribution guidelines.
  • I added unit-tests to validate my changes. All unit tests are passing.
  • I have merged the latest dev branch prior to this PR submission.
  • I ran pre-commit on my changes prior to this PR submission.
  • I submitted this PR against the dev branch.

@kkanas kkanas requested review from a team as code owners March 18, 2026 11:51
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 18, 2026

Test Results

 64 files   64 suites   1h 5m 29s ⏱️
  8 tests   8 ✅  0 💤 0 ❌
256 runs  234 ✅ 22 💤 0 ❌

Results for commit 3ba9c19.

♻️ This comment has been updated with latest results.

@kkanas kkanas changed the title SystemdParameter: block parameter do not need [], add Journal.Compess=yes as default SystemdParameter: block parameter do not need [], add passOnNotFound to allow default parameter query Mar 20, 2026
@kkanas kkanas force-pushed the kkanas/fix-systemdparameter-arg-block branch from a6bd4a1 to d5523b1 Compare March 20, 2026 14:26
… be Compliant if value is not found

Previously block param had to be in `[]` e.g. `[Journal]` to be working.
Now block=Journal will query ini block `[Journal]`

Use case is that systemd-analyze cat-config (and wider systemd) don't
provide API to get default values.
Using parameter passOnNotFound User can asure that default config is
fine, unless overridden with not passing value.

Signed-off-by: Krzysztof Kanas <kkanas@microsoft.com>
@kkanas kkanas force-pushed the kkanas/fix-systemdparameter-arg-block branch from d5523b1 to 81aaee7 Compare March 24, 2026 08:02
@kkanas kkanas changed the title SystemdParameter: block parameter do not need [], add passOnNotFound to allow default parameter query SystemdParameter: block parameter do not need [], add passOnNotFound to make audit succeed if no value is found Mar 24, 2026
Copy link
Copy Markdown
Contributor

@danielszot danielszot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be best to add also at least one test for params.passOnNotFound = false set explicitly to catch when the default value will be changed (on purpose or by mistake).

@kkanas kkanas enabled auto-merge (squash) March 24, 2026 13:32
@kkanas
Copy link
Copy Markdown
Contributor Author

kkanas commented Mar 24, 2026

Would be best to add also at least one test for params.passOnNotFound = false set explicitly to catch when the default value will be changed (on purpose or by mistake).

I believe that the current test are sufficient to test value of passOnNotFound, there are that test for missing values and giving Compliant/Non Compliant. There are test that Check if value is there and flag passOnNotFound.
Unless you have more specific test in mind then I can add it .

@kkanas kkanas merged commit d3faa6a into dev Mar 24, 2026
121 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants