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

Fall back to Get-WmiObject if Get-CimInstance fails #348

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

gscho
Copy link
Contributor

@gscho gscho commented Feb 18, 2021

Signed-off-by: gscho greg.c.schofield@gmail.com

Adds a try-catch block to a powershell helper so any failure to get the win32_operatingsystem using Get-CimInstance will be tried using Get-WmiObject immediately after.

Description

Related Issue

#347

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Signed-off-by: gscho <greg.c.schofield@gmail.com>
@gscho gscho requested review from a team as code owners February 18, 2021 21:48
@tas50
Copy link
Contributor

tas50 commented Feb 18, 2021

@gscho If you add this to the gemfile you can probably avoid the failures on Ruby 2.4/2.5

if Gem.ruby_version < Gem::Version.new("2.6")
  # 16.7.23 required ruby 2.6+
  gem "chef-utils", "< 16.7.23" # TODO: remove when we drop ruby 2.4/2.5
end

Also any idea about those failing windows tests?

@gscho
Copy link
Contributor Author

gscho commented Feb 18, 2021

@tas50 I assumed those would be resolved once #338 is merged. I'll double check that this change has not created new issues that did not exist in previous builds.

@tas50
Copy link
Contributor

tas50 commented Feb 19, 2021

I totally missed that @mwrock fixed it in an open PR

@tas50 tas50 merged commit 6d64fcd into chef:master Feb 19, 2021
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