sous-chefs / powershell

Development repository for the powershell cookbook
https://supermarket.chef.io/cookbooks/powershell
Apache License 2.0
110 stars 88 forks source link

MSU exit code 2359302 #83

Closed andreamaruccia closed 8 years ago

andreamaruccia commented 8 years ago

MSU should not fail on exit code 2359302 (WU_S_ALREADY_INSTALLED) because it only means it has been already installed. Without this change when I am unable to converge the kitchen recipe twice in a row without an error. This would happen if you apply the recipe twice without a reboot.

chef-supermarket commented 8 years ago

Hi. I am an automated pull request bot named Curry. There are commits in this pull request whose authors are not yet authorized to contribute to Chef Software, Inc. projects or are using a non-GitHub verified email address. To become authorized to contribute, you will need to sign the Contributor License Agreement (CLA) as an individual or on behalf of your company. You can read more on Chef's blog.

Non-GitHub Verified Committers

There are 1 commit author(s) whose commits are authored by a non-GitHub verified email address. Chef will have to manually verify that they are authorized to contribute.

Please sign the CLA here.

bheuvel commented 8 years ago

@andreamaruccia did you have a look at #40 and #48 ?

FWIW: From my experience it's usually a signal that something else is not right. Ranging from as simple as reboot to WindowsUpdateService logs filled with various errors.

andreamaruccia commented 8 years ago

Just for some context here are the attributes I use:

"powershell": { "powershell5": { "version": "5.0.10586.117", "url": "https://download.microsoft.com/download/2/C/6/2C6E1B4A-EBE5-48A6-B225-2D2058A9CEFB/Win8.1AndW2K12R2-KB3134758-x64.msu", "checksum": "bb6af4547545b5d10d8ef239f47d59de76daff06f05d0ed08c73eff30b213bf2" }, "installation_reboot_mode": "no_reboot" },

After I install the powershell 5 recipe I have these values in the registry:

(get-ItemProperty HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine).PowershellVersion

Result: 4.0

I ran it again and you can see that it will try to reapply the resource (and exit with code 2359302)

Recipe: powershell::powershell5 * windows_package[Windows Management Framework Core 5.0] action install[2016-03-04T16:18:14+00:00] INFO: Processing windows_package[Windows Management Framework Core 5.0] action install (powershell::powershell5 line 31) [2016-03-04T16:18:14+00:00] INFO: Installing windows_package[Windows Management Framework Core 5.0] version latest Recipe: * remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/Win8.1AndW2K12R2-KB3134758-x64.msu] action create[2016-03-04T16:18:14+00:00] INFO: Processing remote_file[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/Win8.1AndW2K12R2-KB3134758-x64.msu] action create (dynamically defined) (up to date) [2016-03-04T16:18:14+00:00] INFO: Starting installation...this could take awhile.

I always have the same result in the registry:

(get-ItemProperty HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine).PowershellVersion

Result: 4.0

Only after I reboot the os applies the wmf 5 update and when I check the registry again I get this result:

(get-ItemProperty HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine).PowershellVersion

Result: 5.0.10586.117

So my conclusion was that until I reboot the guard will not be able to avoid that the the resource is reapplied. Then the package is reinstalled I actually expect to get exitcode 2359302. In my mind it should not be treated as an error in that case.

What do you think?

jdgoins commented 8 years ago

+1 I have run into this exact same issue. It kills the entire run up until the node is restarted. I'm not sure if there's a better way of doing this, but I see value in this sort of functionality.

jdgoins commented 8 years ago

FYI this is a problem with powershell4 as well. I imagine the change would benefit all of the powershellx recipes.