chocolatey-archive/puppet-chocolatey

Chocolatey provider compatibility with PowerShell provider 2.x

Closed this issue · 20 comments

puppetlabs-powershell just released version 2.0.0. Chocolatey have as a requirement puppetlabs-powershell (>= 1.0.1 < 2.0.0), is it possible to upgrade?

I've moved to 2.0.0 and had nothing but problems thus far. I'm still in the process of try to figure out why chocolatey just flat won't install. Your mileage may vary but I'd avoid for now.

agree with @idoru78 - using 2.0.1 totally breaks autoinstall of chocolatey, reverting to 1.0.6 makes it work again.

ruh roh

2.0.0 had issues, 2.0.1 may have issues - but we did just release the powershell module as a major version change to bring awareness that it was some major rework and may have some issues we have not yet found.

If you are having issues with puppetlabs-powershell 2.0.1, we want to know about them. Join the windows channel in the Puppet community slack - http://slack.puppet.com/

And/or file tickets at https://tickets.puppetlabs.com/browse/MODULES. Thanks!

Yes fails with 2.0.1
On May 31, 2016 12:00 PM, "Rob Reynolds" notifications@github.com wrote:

2.0.0 had issues, 2.0.1 may have issues - but we did just release the
powershell module as a major version change to bring awareness that it was
some major rework and may have some issues we have not yet found.

If you are having issues with puppetlabs-powershell 2.0.1, we want to know
about them. Join the windows channel in the Puppet community slack -
http://slack.puppet.com/

And/or file tickets at https://tickets.puppetlabs.com/browse/MODULES.
Thanks!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#125 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAk2Kga0_4mD24CS37HzwLxxXmlRqfKzks5qHIUrgaJpZM4IkoxC
.

@vinceskahan if you could provide the output of the puppet run with --trace --debug --verbose that would be awesome!

Failed section from a minimal profile of include chocolatey, then package install of notepad++ using provider chocolatey...

Profile:

include chocolatey
package { 'notepadplusplus':
  provider => chocolatey,
}

Error snippets from --trace --debug --verbose

Debug: Puppet::Type::Exec::ProviderPosix: feature posix is missing�[0m
Debug: Puppet::Type::Exec::ProviderShell: feature posix is missing�[0m
Debug: /Package[notepadplusplus]: Provider chocolatey does not support features virtual_packages; not managing attribute allow_virtual�[0m
Debug: Creating default schedules�[0m
Debug: Loaded state in 0.05 seconds�[0m
Debug: /Stage[main]/Chocolatey::Install/before: requires Class[Chocolatey::Config]�[0m
Debug: /Stage[main]/Chocolatey::Install/Windows_env[chocolatey_ChocolateyInstall_env]/notify: subscribes to Exec[install_chocolatey_official]�[0m
Debug: /Stage[main]/Chocolatey::Install/Windows_env[chocolatey_PATH_env]/notify: subscribes to Exec[install_chocolatey_official]�[0m
Info: Applying configuration version '1464734401'�[0m
Debug: 2016-05-31 22:39:47 +0000 C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command - is running as pid: 744�[0m
Debug: Waited 50 milliseconds...�[0m
Debug: Waited 50 milliseconds...�[0m
Debug: Waited 50 milliseconds...�[0m
Debug: Wait object signaled�[0m
Debug: Waited 150 total milliseconds.�[0m
Debug: 2016-05-31 22:39:50 +0000 PIPE> <ReturnResult><Property Name="exitcode">1</Property><Property Name="errormessage">RXhjZXB0aW9uIGNhbGxpbmcgIkVuZEludm9rZSIgd2l0aCAiMSIgYXJndW1lbnQocyk6ICJZb3UgY2Fubm90IGNhbGwgYSBtZXRob2Qgb24gYSBudWxsLXZhbHVlZCBleHByZXNzaW9uLiINCg==</Property><Property Name="stdout"></Property></ReturnResult>
Debug: STDERR: Exception calling "EndInvoke" with "1" argument(s): "You cannot call a method on a null-valued expression."

Debug: Puppet::Type::Package::ProviderChocolatey: file C:\ProgramData\chocolatey\bin\choco.exe does not exist�[0m
Debug: Puppet::Type::Package::ProviderChocolatey: file C:\ProgramData\chocolatey\bin\choco.exe does not exist�[0m
Debug: Finishing transaction 61866800�[0m

Same section using powershell module 1.0.6 which works.....


Debug: Puppet::Type::Exec::ProviderPosix: feature posix is missing�[0m
Debug: Puppet::Type::Exec::ProviderShell: feature posix is missing�[0m
Debug: /Package[notepadplusplus]: Provider chocolatey does not support features virtual_packages; not managing attribute allow_virtual�[0m
Debug: Creating default schedules�[0m
Debug: Loaded state in 0.05 seconds�[0m
Debug: /Stage[main]/Chocolatey::Install/before: requires Class[Chocolatey::Config]�[0m
Debug: /Stage[main]/Chocolatey::Install/Windows_env[chocolatey_ChocolateyInstall_env]/notify: subscribes to Exec[install_chocolatey_official]�[0m
Debug: /Stage[main]/Chocolatey::Install/Windows_env[chocolatey_PATH_env]/notify: subscribes to Exec[install_chocolatey_official]�[0m
Info: Applying configuration version '1464734525'�[0m
Debug: Exec[install_chocolatey_official](provider=powershell): Executing 'cmd.exe /c ""C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command - < "C:\Users\vds\AppData\Local\Temp\puppet-powershell20160531-76-1blhk5g.ps1""'�[0m
Debug: Executing 'cmd.exe /c ""C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command - < "C:\Users\vds\AppData\Local\Temp\puppet-powershell20160531-76-1blhk5g.ps1""'�[0m
Notice: /Stage[main]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: executed successfully�[0m
Debug: /Stage[main]/Chocolatey::Install/Exec[install_chocolatey_official]: The container Class[Chocolatey::Install] will propagate my refresh event�[0m
Debug: Class[Chocolatey::Install]: The container Stage[main] will propagate my refresh event�[0m
Debug: Class[Chocolatey::Install]: The container Class[Chocolatey] will propagate my refresh event
Debug: Prefetching chocolatey resources for package�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe -v'�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe pin list'�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe list -lo -r'�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe pin list'�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe list -lo -r'�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe pin remove -n notepadplusplus'�[0m
Debug: Executing 'C:\ProgramData\chocolatey\bin\choco.exe install notepadplusplus -y '�[0m
Notice: /Stage[main]/Profile_vivodb/Package[notepadplusplus]/ensure: created�[0m
Debug: /Package[notepadplusplus]: The container Class[Profile_vivodb] will propagate my refresh event�[0m
Debug: Class[Profile_vivodb]: The container Stage[main] will propagate my refresh event�[0m
Debug: Class[Chocolatey]: The container Stage[main] will propagate my refresh event�[0m
Debug: Finishing transaction 61845020�[0m
Debug: Storing state�[0m
Debug: Stored state in 0.12 seconds�[0m
Notice: Finished catalog run in 39.54 seconds�[0m

@vinceskahan some important notes we'll need - puppet agent version and a gist of the full output of puppet run. It may show us some other environmental things we had not considered with the recent PowerShell changes.

client 3.7.4, server 3.7.2 with future parser 'off'

choco-fail-with-2.0.1-powershell-module.txt

A couple more quick questions - version of Windows and version of Powershell?

2012 server - powershell version 4


PS C:\Windows\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
4      0      -1     -1

Thanks - R2 or original?

Sigh. R2.
On May 31, 2016 8:24 PM, "Rob Reynolds" notifications@github.com wrote:

Thanks - R2 or original?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#125 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAk2KmE0jiR_EQr2JU8EHGza46QGOiOIks5qHPtXgaJpZM4IkoxC
.

I think we have enough to attempt a repro. 👍

@vinceskahan would you be able to change one line of code in the PowerShell 2 module to verify something for us?

You will see a line in templates/invoke_ps_command.erb (at https://github.com/puppetlabs/puppetlabs-powershell/blob/a0f3cc7498730df9ccde98c1bea40920b0a3643a/lib/puppet_x/templates/invoke_ps_command.erb#L428) that reads:

$ps.EndInvoke($asyncResult)

Could you try changing this to:

if ($ps -ne $null) { $ps.EndInvoke($asyncResult) }

We're not quite certain yet how $ps could have become $null - but at least this will perform some basic validation of the issue.

I'm wondering if there might be an issue with the new PS module particularly for Choco, as Choco also hosts a PowerShell runspace and uses its own PSHost as well.

It does depend on what version he would be using - only 0.9.10 (still in beta) hosts its own.

We've determined this is an issue with the Chocolatey provider, which consequently is fine because it is not yet compatible with the new Powershell Provider.

I'll have a fix up this weekend-ish.

@jordigg @idoru78 @vinceskahan https://forge.puppet.com/chocolatey/chocolatey/1.2.4 released that is compatible with PowerShell provider 2.x.