Skip to content

fix: skip default restart check when custom restart_check_command is provided#13654

Open
AruneshDwivedi wants to merge 1 commit into
hashicorp:mainfrom
AruneshDwivedi:fix/windows-restart-custom-check-command
Open

fix: skip default restart check when custom restart_check_command is provided#13654
AruneshDwivedi wants to merge 1 commit into
hashicorp:mainfrom
AruneshDwivedi:fix/windows-restart-custom-check-command

Conversation

@AruneshDwivedi

Copy link
Copy Markdown

What this fixes

The windows-restart provisioner runs DefaultRestartCheckCommand ([System.Net.Dns]::GetHostName()) even when the user provides a custom restart_check_command. This breaks Windows Constrained Language Mode because the .NET call is not allowed in constrained mode.

Root cause

In waitForCommunicator, the runCustomRestartCheck flag was set to false when using the default command, but after running the custom check, it was set to false again (line 239 old), causing the default check to always run afterward.

What I changed

  • Simplified the runCustomRestartCheck flag logic
  • When a custom restart_check_command is provided, break out of the loop after the custom check succeeds — skip the default PowerShell module-load check entirely
  • The user's custom command is sufficient to verify the restart

Fixes #13643

…provided

When a user provides a custom restart_check_command to the windows-restart
provisioner, the DefaultRestartCheckCommand (which uses [System.Net.Dns]::GetHostName())
was still being executed afterward. This breaks Windows Constrained Language Mode
because that .NET call is not allowed in constrained mode.

Fix: when a custom restart_check_command is provided, skip the default
PowerShell module-load check entirely. The user's custom command is sufficient
to verify the restart.

Fixes hashicorp#13643
@AruneshDwivedi AruneshDwivedi requested a review from a team as a code owner June 5, 2026 08:36
@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

1 similar comment
@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant