rgl / packer-plugin-windows-update

Packer plugin for installing Windows updates
Mozilla Public License 2.0
299 stars 71 forks source link

Update windows-update.ps1 #145

Closed TheSleepingFox closed 1 month ago

TheSleepingFox commented 1 month ago

adding try-catch for LastDeploymentChangeTime with default to todays date.

TheSleepingFox commented 1 month ago

This shoud hopefully fix Issue #144 Unfortunately I don't have access to an environment with 'make' currently, so unable to compile and confirm.

rgl commented 1 month ago

The stack trace from #144 points to https://github.com/rgl/packer-plugin-windows-update/blob/v0.16.0/update/windows-update.ps1#L190 but why is that LastDeploymentChangeTime $null at all?

Using the current date does not seem appropriate, as it varies. Using a static 1970-01-01 would be more appropriate to signal that something is odd with the date. Or even, make it $null or unknown.

TheSleepingFox commented 1 month ago

I hadn't looked through the rest of your script to see where it is used. So didn't want to pass through as $null and potentially hit other $null value exceptions. Linux Epoch time works. Unless you're filtering to only recent patches to avoid showing Ancient stuff.

On Wed, Jul 10, 2024, 5:46 PM Rui Lopes @.***> wrote:

The stack trace from #144 https://github.com/rgl/packer-plugin-windows-update/issues/144 points to https://github.com/rgl/packer-plugin-windows-update/blob/v0.16.0/update/windows-update.ps1#L190 but why is that LastDeploymentChangeTime $null at all?

Using the current date does not seem appropriate, as it varies. Using a static 1970-01-01 would be more appropriate to signal that something is odd with the date. Or even, make it $null or unknown.

— Reply to this email directly, view it on GitHub https://github.com/rgl/packer-plugin-windows-update/pull/145#issuecomment-2219849971, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIR566EFVYUWONKLXL4JVTDZLTUXNAVCNFSM6AAAAABKUDYKS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZHA2DSOJXGE . You are receiving this because you authored the thread.Message ID: @.***>

markusheiliger commented 1 month ago

To me it looks like the LastDeploymentChangeTime is only accessed to generate the update summary output. So moving on with the NULL value is maybe no dealbreaker (its just the output that looks a little bit strange). Especially for those folks (including me) who love and rely on this plugin as part of their image factory.

jbne commented 1 month ago

Do we know if $update could be null at that point as well? Doesn't seem like the likely culprit, but the stack trace doesn't give an indication on which piece is null.

rgl commented 1 month ago

$update or $update.LastDeploymentChangeTime being $null is quite strange. It seems something odd is happening elsewhere.

looking at the error in https://github.com/rgl/packer-plugin-windows-update/issues/144#issuecomment-2221084570, it seems to infer that KB5007651 has some kind of problem.

by any change have you guys tried to install that KB5007651 manually (e.g. from the windows update app)? did it work?

rgl commented 1 month ago

this was superseed with https://github.com/rgl/packer-plugin-windows-update/commit/27a4abb412c8ba6a67318d54794f41f201a549ec.

please try https://github.com/rgl/packer-plugin-windows-update/releases/tag/v0.16.1