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

Only poll vmware attributes when on vmware #662

Merged
merged 1 commit into from
Dec 8, 2015
Merged

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Dec 1, 2015

This will prevent Azure guests that contain the vmware toolbox CLI from being identified as vmware hosts. We shouldn't even try to grab vmware values unless dmidecode has identified the host as vmware. Added specs for when the CLI is missing and when we're not running on vmware.

@tas50
Copy link
Contributor Author

tas50 commented Dec 1, 2015

Tested on Azure and we no longer get a pile of empty attributes. Tested on vmware fusion with both the compiled vmware tools and the open tools available via apt and both do what you'd expect.

@tas50 tas50 added this to the 8.9.0 milestone Dec 3, 2015
vmware[param] = from_cmd("#{vmtools_path} stat #{param}")
if vmware[param] =~ /UpdateInfo failed/
vmware[param] = nil
if virtualization[:systems][:vmware]
Copy link
Contributor

Choose a reason for hiding this comment

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

You can avoid indenting the entirety of this method by pairing this check with the call to the method:

collect_data(:linux) do
  get_vm_attributes("/usr/bin/vmware-toolbox-cmd") if virtualization[:systems][:vmware]
end

@mcquin
Copy link
Contributor

mcquin commented Dec 4, 2015

LGTM. (#662 (comment) is only a suggestion)

This prevents an empty vmware hash with nil values being created on
azure where the vmware tools are on the ubuntu image.
@tas50
Copy link
Contributor Author

tas50 commented Dec 5, 2015

Much simpler. Rebased with that @mcquin

@mcquin
Copy link
Contributor

mcquin commented Dec 7, 2015

Awesome. Looks good!

@thommay
Copy link
Contributor

thommay commented Dec 7, 2015

👍

tas50 added a commit that referenced this pull request Dec 8, 2015
Only poll vmware attributes when on vmware
@tas50 tas50 merged commit 8e9ef8f into chef:master Dec 8, 2015
@tas50 tas50 deleted the vmware branch December 10, 2015 03:27
@thommay thommay added Type: Bug Does not work as expected. and removed Bug labels Jan 24, 2017
@chef chef locked and limited conversation to collaborators Nov 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Does not work as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants