Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling for Grains virtual hardware identification #39504

Merged
merged 2 commits into from
Feb 22, 2017

Conversation

F30
Copy link
Contributor

@F30 F30 commented Feb 19, 2017

What does this PR do?

This should mitigate the "Although 'dmidecode' was found in path, the current user cannot execute it" warning, which is a frequent annoyance when running Salt as non-root user (#2494, Thread, #5249, #39184). It also fixes some other flaws in the function's error handling which appear to have creeped in over time.

Previous Behavior

Message gets logged with level "warning".

New Behavior

Message gets logged with level "info".

Changing the loglevel is more of an ugly hack, but loglevels aren't consistent within the module anyway and fixing the error detection would probably require major refactoring of the whole function.

Speaking of that, the logic and error handling are a bit of a mess anyway, so the function might actually be a good candidate for refactoring. For example, the general error message is logged before and the error messages for individual commands and further identification logic.

Tests written?

No.

F30 added 2 commits February 19, 2017 21:38
Some logical flaws appear to have creeped in over time and the log
message didn't really make sense anymore.
"Although 'dmidecode' was found in path, the current user cannot execute
it" is a frequent annoyance when running Salt as non-root
user. [1] [2] [3] [4]
This is more of an ugly hack, but fixing the underlying problem would
probably require major refactoring of the whole function.

[1] saltstack#2494 (comment)
[2] https://groups.google.com/d/topic/salt-users/aM11D1mIV4c/discussion
[3] saltstack#5249 (comment)
[4] saltstack#39184
@F30 F30 changed the title Dmidecode warning Improve error handling for Grains virtual hardware identification Feb 19, 2017
@rallytime
Copy link
Contributor

Go Go Jenkins!

@cachedout cachedout merged commit a9094ad into saltstack:develop Feb 22, 2017
terminalmage added a commit to terminalmage/salt that referenced this pull request Feb 26, 2017
saltstack#39504 fixed what was a legitimate
bug, but in turn this causes this warning to be logged hundreds of times
in the minion log on unprivileged containers.

This commit changes the log level for this message to debug.
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