Skip to content

host_inventory/ohai: Suppress error messages to avoid parse error - #765

Merged
mizzy merged 1 commit into
mizzy:masterfrom
ryot4:suppress-ohai-error
Jul 5, 2026
Merged

host_inventory/ohai: Suppress error messages to avoid parse error#765
mizzy merged 1 commit into
mizzy:masterfrom
ryot4:suppress-ohai-error

Conversation

@ryot4

@ryot4 ryot4 commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

When dmidecode is not available on the host, ohai outputs the following error in addition to its JSON output.

$ ohai
[2026-07-04T21:32:52+09:00] ERROR: shard_seed: Failed to get dmi property serial_number: is dmidecode installed?

The above error is printed to stderr, but when request_pty is set to true, stderr is merged into stdout as discussed in the following issue:

This causes JSON parse error and makes host_inventory['ohai'] be nil. This PR fixes it by suppressing error messages.

ohai prints errors to stderr, but when request_pty is true, they are
merged into stdout and causes parse error.
@mizzy

mizzy commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Thanks!

@mizzy
mizzy merged commit c2f55bf into mizzy:master Jul 5, 2026
10 checks passed
@mizzy

mizzy commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Released as v2.95.1.

@ryot4
ryot4 deleted the suppress-ohai-error branch July 5, 2026 07:13
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.

2 participants