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

Inconsistent behavior in Boltspec::Run.run_command on Windows #1492

Closed
glennsarti opened this issue Dec 17, 2019 · 3 comments
Closed

Inconsistent behavior in Boltspec::Run.run_command on Windows #1492

glennsarti opened this issue Dec 17, 2019 · 3 comments
Labels
Bug Bug reports and fixes.

Comments

@glennsarti
Copy link
Contributor

Describe the Bug

When the WinRM transport is used with the run_command method, Bolt leverages the WinRM gem and deliberately chooses to create a PowerShell session on the remote host.

Using the local_windows transport to execute commands on the local host however is different. A simple call to Open3.capture3 is made.

The effect on the end user is that the behavior of commands given to run_command is inconsistent.

Litmus for instance exposes a method called run_shell that ends up leveraging run_command. Users that want to test their module using Litmus would be forced to detect within their test suite which scenario they are in at run time, local or remote, and if local, wrap their own commands in 'powershell.exe -noprofile -command ' boilerplate on their own.

Instead, since the better default choice has already been made for WinRM transport commands, it seems like it could solve the issue closer to the source if the local transport were made to implement it's own wrapper, so that all consumers of the run_command method in Bolt spec, whether they be end users or frameworks, could enjoy consistency in the behavior of their commands.

As an example of users already affected see this PR comment in which we are already faced with this difficulty while converting a module's test suite to Litmus.

Expected Behavior

Running a task locally or over WinRM should work the same without the need to change the command

Steps to Reproduce

See the comments in https://tickets.puppetlabs.com/browse/BOLT-1429 for more information

@glennsarti glennsarti added the Bug Bug reports and fixes. label Dec 17, 2019
@glennsarti
Copy link
Contributor Author

Ping @RandomNoun7 and @michaeltlombardi as commenters on the Jira ticket.

@glennsarti
Copy link
Contributor Author

Also note that the ruby-pwsh gem https://rubygems.org/gems/ruby-pwsh now makes managing PowerShell instances much easier and safer

@lucywyman
Copy link
Contributor

Closed by #1708

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug reports and fixes.
Projects
None yet
Development

No branches or pull requests

2 participants