Open HerbBoy opened 2 years ago
Update: PowerShell Core Version: 7.2.1-1.rh appeared to be the root cause of this issue.
Downgrading back to PowerShell Core Version: 7.2.0-1.rh InSpec works without modification to the transport vmware.rb module.
However, I am not sure if this means it is an issue with PowerShell or still the way InSpec train is parsing the stdout stdin and stderr.
Keeping this open for the time being.
is there any movement to get this resolved?
bumping again.
Version:
4.52.9
Environment:
PowerCLI Version: 12.5.0.19195797 OS: RHEL 8.4 PowerShell Core Version: 7.2.1-1.rh
Scenario:
This appeared in an offline, highside env. All dependencies already present (inspec, powershell core).
I first tried to import the library.
After that did not work, I just copied over the structure and placed the VMware.PowerCLI and all its dependencies into /root/.local/share/powershell/Modules/
After I did that I was able to run PowerCLI commands. Connect to a server etc.
However I get the following error from InSpec
The file in question: /opt/inspec/embedded/lib/ruby/gems/2.7.0/gems/train-3.8.6/lib/train/transports/vmware.rb
The issue is how the logic is handled to identify the PowerCLI version:
If this is switched to:
This will work regardless of if it was installed or imported, or the files placed in the module directories.
However changing this then makes the actual stdout to contain data that breaks the logic currently in place to capture the return code sent from stdin.
As you can see from the above output, "ion)" remains in the stdout which is actually from the initial command containing the last 5 characters of the word "Version"
This could be solved by changing the logic used to parse out the return code.
Steps to Reproduce:
Expected Result:
For this to function without issue as it does when modules are installed or imported.
Actual Result:
Fails