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

New response structure from powershell communicator? #54

Open
matt-richardson opened this issue Jun 27, 2018 · 2 comments
Open

New response structure from powershell communicator? #54

matt-richardson opened this issue Jun 27, 2018 · 2 comments
Labels

Comments

@matt-richardson
Copy link
Contributor

matt-richardson commented Jun 27, 2018

Been having fun with some random vagrant failures over the last few days. Had some fun issues with

del : Cannot remove item C:\Windows\Temp\WinRM_Elevated_Shell.log: The process 
cannot access the file 'C:\Windows\Temp\WinRM_Elevated_Shell.log' because it 
is being used by another process.

This appears to be WinRb/winrm-elevated#5, which looks to be included in vagrant 1.9.2:

communicator/winrm: Refactor WinRM communicator to use latest WinRM gems and V2 API [GH-8102]

So we tried upgrading vagrant from 1.8.7 to 2.1.1, and vagrant-dsc started failing with

DEBUG winrmshell: [WinRM] Command created for $PSVersionTable.PSVersion.Major
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: EA366057-56DB-48F6-B3B5-1FDC85DA769F
DEBUG winrmshell: [WinRM] creating command_id: EA366057-56DB-48F6-B3B5-1FDC85DA769F on shell_id 8326E7FE-7335-4609-ADF1-455FE790A6A0
DEBUG winrmshell: [WinRM] Waiting for output...
DEBUG winrmshell: [WinRM] Processing output
DEBUG winrmshell: [WinRM] cleaning up command_id: EA366057-56DB-48F6-B3B5-1FDC85DA769F on shell_id 8326E7FE-7335-4609-ADF1-455FE790A6A0
DEBUG winrmshell: Output: #<WinRM::Output:0x0000000101e14860 @data=[{:stdout=>"5\r\n"}], @exitcode=0>
version is '#<WinRM::Output:0x0000000101e14860>'
version.exitcode is '0'
version.stdout is '5
'
ERROR warden: Error occurred: undefined method `data' for #<WinRM::Output:0x0000000101e14860>

I suspect that this changed the return structure that we expect in get_guest_powershell_version, get_lcm_state and get_configuration_status.

Tweaking my local copy of vagrant-dsc, to change from:

return version[:data][0][:stdout]

to

version.stdout

makes it happy again (with the same kind of change in the other 2 spots as well).

I'm happy to stick in a PR, but I'd be concerned that it makes it not backwards compatible... And my ruby chops aren't good enough to code it in a backwards compatible way...

matt-richardson added a commit to OctopusDeploy/vagrant-dsc that referenced this issue Jun 27, 2018
Hack to make it work with Vagrant 2.1.1.

Fixes mefellows#54 (but not in a backwards compatible way)
@matt-richardson matt-richardson changed the title Failure with new version of vagrant New response structure from powershell communicator? Jun 27, 2018
@matt-richardson
Copy link
Contributor Author

We've done the hacky fix in our fork - OctopusDeploy@603c2f1 to unblock us for now, but would really prefer to do it properly.

@mefellows mefellows added the bug label Jun 27, 2018
@mefellows
Copy link
Owner

Thanks @matt-richardson! I won't have time to look into this any time soon, but will leave this open in the hopes that somebody will be able to pick it up and help.

Apologies - as discussed I (happily) haven't spent any time on Windows for a long while :)

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

No branches or pull requests

2 participants