fix: CHEF-33393 - Fall back to PowerShell syntax for arch detection in WinRM sessions#832
Merged
Nik08 merged 1 commit intoJun 11, 2026
Conversation
…n PowerShell WinRM sessions When wmic is unavailable (e.g., Windows Server 2025 where wmic is deprecated), read_cmd_os falls back to 'echo %PROCESSOR_ARCHITECTURE%'. In PowerShell-based WinRM sessions (the default for Test Kitchen), CMD-style variable expansion is not supported and the literal string '%PROCESSOR_ARCHITECTURE%' is returned. This fix detects the unexpanded literal and falls back to the PowerShell-native syntax '$env:PROCESSOR_ARCHITECTURE', ensuring os.arch is correctly set to 'x86_64' in PowerShell WinRM sessions on Windows 2025. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Nik08 <nikita.mathur@progress.com>
This was referenced Jun 5, 2026
Nik08
added a commit
to chef/chef-web-docs
that referenced
this pull request
Jun 12, 2026
Fixed Windows architecture detection over WinRM when os.arch was missing or unknown. Adds robust fallback detection in Train and InSpec. ([#7935](inspec/inspec#7935), train [#832](inspec/train#832)) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Nik08 <nikita.mathur@progress.com>
Nik08
added a commit
to chef/chef-web-docs
that referenced
this pull request
Jun 12, 2026
Fixed Windows architecture detection over WinRM when os.arch was missing or unknown. Adds robust fallback detection in Train and InSpec. ([#7935](inspec/inspec#7935), train [#832](inspec/train#832)) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Nik08 <nikita.mathur@progress.com>
lbarry316
added a commit
to chef/chef-web-docs
that referenced
this pull request
Jun 25, 2026
* Add Chef InSpec 5.24.* release notes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Mohan Chhalotre <mchhalot@progress.com> * remove ticket number Signed-off-by: Mohan Chhalotre <mchhalot@progress.com> * Added omnibus submodule doc Signed-off-by: Chandra <cprasad@progress.com> * Add Windows arch detection bug fix to InSpec 5.24 release notes Fixed Windows architecture detection over WinRM when os.arch was missing or unknown. Adds robust fallback detection in Train and InSpec. ([#7935](inspec/inspec#7935), train [#832](inspec/train#832)) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Nik08 <nikita.mathur@progress.com> * updated gem dependency entry Signed-off-by: Chandra <cprasad@progress.com> * docs: inspec release notes — add nokogiri test dependency upgrade note Mentioned the nokogiri test dependency upgrade from 1.17.1 to 1.18.10 under 'Key features / Improvements' in the Chef InSpec 5.24.17 release notes, specifying it as a test dependency to distinguish it from runtime security fixes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Chandra <cprasad@progress.com> * docs: inspec release notes — add nokogiri to security fixes section Added nokogiri test dependency upgrade (1.17.1 to 1.18.10) to the Security fixes section of Chef InSpec 5.24.17 release notes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Chandra <cprasad@progress.com> * Edit release notes Signed-off-by: Ian Maddaus <ian.maddaus@progress.com> * updated net-imap PR ref Signed-off-by: Chandra <cprasad@progress.com> * updated Dependency update sec Signed-off-by: Chandra <cprasad@progress.com> * Minor edits Signed-off-by: Ian Maddaus <ian.maddaus@progress.com> * Updated the inspec 5.24.x version with latest bump Signed-off-by: Nik08 <nikita.mathur@progress.com> * Updated release notes with removal of --overwrite change Signed-off-by: Nik08 <nikita.mathur@progress.com> * --overwrite breaking changes Signed-off-by: Ian Maddaus <ian.maddaus@progress.com> * Update based on input from Aditya and Vasundhara to inspec.md Signed-off-by: lbarry316 <118758673+lbarry316@users.noreply.github.com> * Removed the Breaking changes section (as requested by Aditya) - inspec.md Signed-off-by: lbarry316 <118758673+lbarry316@users.noreply.github.com> * Updated the release date (based on Vasundhara's message) inspec.md Signed-off-by: lbarry316 <118758673+lbarry316@users.noreply.github.com> * Added Deprecations section to inspec.md Signed-off-by: lbarry316 <118758673+lbarry316@users.noreply.github.com> * Added link inspec.md Signed-off-by: lbarry316 <118758673+lbarry316@users.noreply.github.com> * updated release version Signed-off-by: Chandra <cprasad@progress.com> --------- Signed-off-by: Mohan Chhalotre <mchhalot@progress.com> Signed-off-by: Chandra <cprasad@progress.com> Signed-off-by: Nik08 <nikita.mathur@progress.com> Signed-off-by: Ian Maddaus <ian.maddaus@progress.com> Signed-off-by: lbarry316 <118758673+lbarry316@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Chandra <cprasad@progress.com> Co-authored-by: Nik08 <nikita.mathur@progress.com> Co-authored-by: Ian Maddaus <ian.maddaus@progress.com> Co-authored-by: lbarry316 <118758673+lbarry316@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Windows Server 2025,
wmichas been deprecated and removed. When train falls back toread_cmd_osfor architecture detection, it runsecho %PROCESSOR_ARCHITECTURE%which is CMD batch syntax. However, WinRM sessions in Test Kitchen default to PowerShell, where%VAR%expansion is not supported — the literal string%PROCESSOR_ARCHITECTURE%is returned instead.This left
os.archasnil/unknown, which caused the InSpecpackageresource to skipWOW6432Noderegistry paths, making 32-bit packages (e.g. .NET Framework SDK, VC++ x86 redistributables) appear as "not installed" duringkitchen verify.Fix: In
read_cmd_os, detect when the CMD command returns the unexpanded literal and fall back to the PowerShell-native$env:PROCESSOR_ARCHITECTURE.Related Issue
CHEF-33393 — InSpec Package Resource Fails in Kitchen Verify on Windows
Types of changes
Checklist: