Skip to content

Add configurable winpass_timeout for Windows password reset and migrate Chefstyle to Cookstyle#139

Merged
Stromweld merged 4 commits into
test-kitchen:mainfrom
sanjain-progress:sanjain/CHEF-33241/password_timeout
Jul 2, 2026
Merged

Add configurable winpass_timeout for Windows password reset and migrate Chefstyle to Cookstyle#139
Stromweld merged 4 commits into
test-kitchen:mainfrom
sanjain-progress:sanjain/CHEF-33241/password_timeout

Conversation

@sanjain-progress

Copy link
Copy Markdown
Contributor

Description

Adds a new winpass_timeout configuration option to allow users to specify a custom timeout (in seconds) for the Windows password reset operation performed by gcewinpass.

This fixes the Timeout::Error: Timeout while waiting for password agent to perform password reset error that occurs when the GCE Windows password agent takes longer than the default timeout to initialize.

Changes

  • Added winpass_timeout config option (defaults to nil, preserving backward compatibility)
  • When set, the timeout value is passed to GoogleComputeWindowsPassword
  • Added unit tests for the new configuration option

Example kitchen.yml

---
driver:
  name: gce
  project: my-gcp-project
  zone: us-central1-a
  email: user@example.com
  machine_type: n1-standard-2
  disk_size: 80
  metadata:
    serial-port-enable: "true"

provisioner:
  name: chef_infra
  product_name: chef
  wait_for_retry: 5
  max_retries: 600

platforms:
  - name: windows-2022
    driver:
      winpass_timeout: 300
      image_project: my-gcp-project
      image_name: my-windows-image
      image_os_type: windows

transport:
  name: winrm
  port: 5985
  username: my_user

suites:
  - name: default
    run_list:
    verifier:
      name: inspec

Before (without winpass_timeout)

$ kitchen create
-----> Starting Chef Test Kitchen (v2.0.15)
-----> Creating <default-windows-2022>...
$$$$$$ These configs are deprecated - consider using new disks configuration
       Creating GCE instance <tk-default-windows-2022-ded241> in project my-gcp-project, zone us-central1-a...
       Creating a 80 GB boot disk named tk-default-windows-2022-ded241-disk1 from image my-windows-image...
       Current status: RUNNING
       Current status: DONE
       Server <tk-default-windows-2022-ded241> created.
       Resetting the Windows password for user my_user on tk-default-windows-2022-ded241...
>>>>>> Error encountered during server creation: Timeout::Error: Timeout while waiting for password agent to perform password reset
       Destroying GCE instance <tk-default-windows-2022-ded241>...
       Current status: RUNNING
       Current status: DONE
       GCE instance <tk-default-windows-2022-ded241> destroyed.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Failed to complete #create action: [Timeout while waiting for password agent to perform password reset] on default-windows-2022
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

After (with winpass_timeout: 300)

$ kitchen create
-----> Starting Chef Test Kitchen (v2.0.15)
-----> Creating <default-windows-2022>...
$$$$$$ These configs are deprecated - consider using new disks configuration
       Creating GCE instance <tk-default-windows-2022-ba40ed> in project my-gcp-project, zone us-central1-a...
       Creating a 80 GB boot disk named tk-default-windows-2022-ba40ed-disk1 from image my-windows-image...
       Current status: RUNNING
       Current status: DONE
       Server <tk-default-windows-2022-ba40ed> created.
       Resetting the Windows password for user my_user on tk-default-windows-2022-ba40ed...
       Password reset complete on tk-default-windows-2022-ba40ed complete.
       Waiting for server <tk-default-windows-2022-ba40ed> to be ready...
       [WinRM] Established

       GCE instance <tk-default-windows-2022-ba40ed> created and ready.
       Finished creating <default-windows-2022> (4m2.25s).

Related Issue

Fixes #117

Sachin Jain added 4 commits July 1, 2026 10:30
Fixes an issue where the Windows password reset operation would timeout
with 'Timeout::Error: Timeout while waiting for password agent to perform
password reset' on instances that take longer to initialize the password
agent.

Added a new 'winpass_timeout' configuration option (defaults to nil) that
allows users to specify a custom timeout (in seconds) for the gcewinpass
password reset operation. When not set, the default timeout from gcewinpass
is used, preserving backward compatibility.

Usage in kitchen.yml:
  driver:
    winpass_timeout: 300

Fixes: test-kitchen#117
Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
Switch linting dependency from chefstyle to cookstyle (~> 8.7) and
update Rakefile to use cookstyle/chefstyle require pattern, aligning
with other test-kitchen plugins (e.g. kitchen-ec2).

Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
Fix 5 auto-correctable offenses detected by cookstyle:
- Layout/HashAlignment: align hash keys in update_windows_password
- Style/RedundantReturn: remove redundant return in image_url

Signed-off-by: Sachin Jain <Sachin.jain@chef.io>
@sanjain-progress
sanjain-progress marked this pull request as ready for review July 2, 2026 10:59
@sanjain-progress sanjain-progress changed the title Add configurable winpass_timeout for Windows password reset Add configurable winpass_timeout for Windows password reset and migrate Chefstyle to Cookstyle Jul 2, 2026
@Stromweld
Stromweld merged commit b96059e into test-kitchen:main Jul 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timeout::Error: Timeout while waiting for password agent to perform password reset

2 participants