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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions salt/grains/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,14 +685,14 @@ def _virtual(osdata):
grains['virtual'] = 'kvm'
elif 'joyent smartdc hvm' in model:
grains['virtual'] = 'kvm'
break
else:
if osdata['kernel'] in skip_cmds:
if osdata['kernel'] not in skip_cmds:
log.warning(
"The tools 'dmidecode' and 'lspci' failed to "
'execute because they do not exist on the system of the user '
'running this instance or the user does not have the '
'necessary permissions to execute them. Grains output might '
'not be accurate.'
'All tools for virtual hardware identification failed to '
'execute because they do not exist on the system running this '
'instance or the user does not have the necessary permissions '
'to execute them. Grains output might not be accurate.'
)

choices = ('Linux', 'OpenBSD', 'HP-UX')
Expand Down Expand Up @@ -851,7 +851,7 @@ def _virtual(osdata):
grains['virtual_subtype'] = 'Xen Dom0'

for command in failed_commands:
log.warning(
log.info(
"Although '{0}' was found in path, the current user "
'cannot execute it. Grains output might not be '
'accurate.'.format(command)
Expand Down