Skip to content

Fixed crash on JSON null values in host_specific.json - #6507

Open
djbclark wants to merge 1 commit into
cfengine:masterfrom
djbclark:fix/cmdb-null-value-crash-r4
Open

djbclark wants to merge 1 commit into
cfengine:masterfrom
djbclark:fix/cmdb-null-value-crash-r4

Conversation

@djbclark

Copy link
Copy Markdown
Contributor

A null variable value in host_specific.json crashed cf-agent and cf-promises. Reject it and keep loading valid entries.

Behavior chosen: a scalar null is logged as an error and skipped, the rest of the file still loads, and nulls inside lists and data keep their current meaning. If you would prefer it to be fatal, an empty string, or to undefine the variable, I can change it.

Debug test: fails before, passes after; 12/12 CMDB tests pass. AI-assisted.

Details: issue, tests and reviews.

Reject null scalar values and keep loading valid entries.

Changelog: Title
Ticket: none
Signed-off-by: Daniel JB Clark <djbclark@gmail.com>
@cf-bottom

Copy link
Copy Markdown

Thanks for submitting a pull request! Maybe @craigcomstock can review this?

@larsewi

larsewi commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

@craigcomstock craigcomstock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@craigcomstock craigcomstock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Of course. We must wait on CI to be green.

@djbclark

Copy link
Copy Markdown
Contributor Author

Is there a way I can get to this, or can someone with access (I get 403) copy-paste?

https://ci.cfengine.com/job/sequential-tests/1292/consoleText

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants