train icon indicating copy to clipboard operation
train copied to clipboard

Transports that detect Powershell Core (pwsh) or Powershell (powershell) do not function if Powershell Core is also installed on Windows.

Open rlakey opened this issue 3 years ago • 0 comments

Version:

3.8.1

Environment:

Windows

Scenario:

Transports that detect Powershell Core (pwsh) or Powershell (powershell) do not function if Powershell Core is also installed on Windows.

Powershell Core is cross platform so it can't be assumed to mean Linux or Mac.

Steps to Reproduce:

Install Powershell 7 on a Windows 10 system. Attempt to run a profile with the vmware transport.

Expected Result:

Playbook executes successfully.

Actual Result:

The logic in vmware.rb detects the pwsh executable on Windows but then seems to perform functions that to not work on Windows but do work fine on Linux.

<internal:io>:63:in `read_nonblock': A non-blocking socket operation could not be completed immediately. - read would block (IO::EWOULDBLOCKWaitReadable)
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:122:in `flush_stdout'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:189:in `session'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:146:in `parse_pwsh_output'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:87:in `run_command_via_connection'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:64:in `connect'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:54:in `initialize'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:17:in `new'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/train-3.8.1/lib/train/transports/vmware.rb:17:in `connection'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.41.20/lib/inspec/backend.rb:38:in `create'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.41.20/lib/inspec/runner.rb:87:in `configure_transport'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.41.20/lib/inspec/runner.rb:79:in `initialize'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.41.20/lib/inspec/cli.rb:284:in `new'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.41.20/lib/inspec/cli.rb:284:in `exec'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-core-4.41.20/lib/inspec/base_cli.rb:35:in `start'
        from C:/opscode/chef-workstation/embedded/lib/ruby/gems/3.0.0/gems/inspec-bin-4.41.20/bin/inspec:11:in `<top (required)>'
        from C:/opscode/chef-workstation/bin/inspec:386:in `load'
        from C:/opscode/chef-workstation/bin/inspec:386:in `<main>'

rlakey avatar Feb 08 '22 01:02 rlakey