rgl / packer-plugin-windows-update

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

Add Retry to script upload and update functions #103

Closed feiyushi closed 3 years ago

feiyushi commented 3 years ago

This change attempts to address issues seen in #101, #87, #78, #65, #22.

feiyushi commented 3 years ago

We are testing the changes and please also review the approach for adding max retries for update function. @rgl

feiyushi commented 3 years ago

We are testing the changes and please also review the approach for adding max retries for update function. @rgl

A log snippet shows retry on update exit code 16001 works.

PACKER OUT ==> azure-arm: Running Windows update...
PACKER ERR 2021/07/31 21:18:07 packer-builder-azure-arm plugin: [INFO] RPC endpoint: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:07 [INFO] RPC client: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:07 [INFO] RPC endpoint: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:07 packer-provisioner-windows-update plugin: 2021/07/31 21:18:07 [INFO] 28 bytes written for 'stdout'
PACKER ERR 2021/07/31 21:18:07 packer-provisioner-windows-update plugin: 2021/07/31 21:18:07 [INFO] 0 bytes written for 'stderr'
PACKER ERR 2021/07/31 21:18:07 packer-provisioner-windows-update plugin: 2021/07/31 21:18:07 [INFO] RPC client: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:07 packer-builder-azure-arm plugin: [INFO] starting remote command: PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1
PACKER OUT     azure-arm: Searching for Windows updates...
PACKER ERR 2021/07/31 21:18:37 packer-builder-azure-arm plugin: [INFO] command 'PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1' exited with code: 16001
PACKER ERR 2021/07/31 21:18:37 packer-builder-azure-arm plugin: [INFO] RPC endpoint: Communicator ended with: 16001
PACKER ERR 2021/07/31 21:18:37 [INFO] 34 bytes written for 'stdout'
PACKER ERR 2021/07/31 21:18:37 [INFO] 0 bytes written for 'stderr'
PACKER ERR 2021/07/31 21:18:37 [INFO] RPC client: Communicator ended with: 16001
PACKER ERR 2021/07/31 21:18:37 [INFO] RPC endpoint: Communicator ended with: 16001
PACKER ERR 2021/07/31 21:18:37 packer-provisioner-windows-update plugin: 2021/07/31 21:18:37 [INFO] 34 bytes written for 'stdout'
PACKER ERR 2021/07/31 21:18:37 packer-provisioner-windows-update plugin: 2021/07/31 21:18:37 [INFO] 0 bytes written for 'stderr'
PACKER ERR 2021/07/31 21:18:37 packer-provisioner-windows-update plugin: 2021/07/31 21:18:37 [INFO] RPC client: Communicator ended with: 16001
PACKER ERR 2021/07/31 21:18:37 packer-provisioner-windows-update plugin: 2021/07/31 21:18:37 Retryable error: Windows update script exited with non-zero exit status: 16001
PACKER ERR 2021/07/31 21:18:42 packer-builder-azure-arm plugin: [INFO] starting remote command: PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1
PACKER OUT     azure-arm: Searching for Windows updates...
PACKER ERR 2021/07/31 21:18:57 packer-builder-azure-arm plugin: [INFO] command 'PowerShell -ExecutionPolicy Bypass -OutputFormat Text -File C:/Windows/Temp/packer-windows-update-elevated.ps1' exited with code: 0
PACKER OUT     azure-arm: No Windows updates found
PACKER ERR 2021/07/31 21:18:57 packer-builder-azure-arm plugin: [INFO] RPC endpoint: Communicator ended with: 0
PACKER OUT ==> azure-arm: Provisioning with Powershell...
PACKER ERR 2021/07/31 21:18:57 [INFO] 60 bytes written for 'stdout'
PACKER OUT ==> azure-arm: Provisioning with powershell script: /tmp/powershell-provisioner657462132
PACKER ERR 2021/07/31 21:18:57 [INFO] 0 bytes written for 'stderr'
PACKER ERR 2021/07/31 21:18:57 [INFO] RPC client: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:57 [INFO] RPC endpoint: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:57 packer-provisioner-windows-update plugin: 2021/07/31 21:18:57 [INFO] 60 bytes written for 'stdout'
PACKER ERR 2021/07/31 21:18:57 packer-provisioner-windows-update plugin: 2021/07/31 21:18:57 [INFO] 0 bytes written for 'stderr'
PACKER ERR 2021/07/31 21:18:57 packer-provisioner-windows-update plugin: 2021/07/31 21:18:57 [INFO] RPC client: Communicator ended with: 0
PACKER ERR 2021/07/31 21:18:57 [INFO] (telemetry) ending windows-update
rgl commented 3 years ago

Thank You! This was released with https://github.com/rgl/packer-plugin-windows-update/releases/tag/v0.14.0 :-)