Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converge fails with irrelevant error message on windows when platform name not starting with windows* #1962

Open
MozammilMinhajTR opened this issue Jan 29, 2024 · 0 comments

Comments

@MozammilMinhajTR
Copy link

👻 Brief Description

We are trying to setup kitchen.yml for windows with ec2 driver.
When platform name is mentioned starting with windows-, create, converge and rest workflow works as expected however when platform name is mentioned something else, converge steps errors out.

Failed to complete #converge action: [[WinRM::FS::Core::FileTransporter] Upload failed (exitcode: 0), but stderr present
Cannot create "C:\Users\Administrator\AppData\Local\Temp\kitchen" because a file or directory with the same name already exists.

Version

root@:~# chef --version
Chef Workstation version: 23.12.1055
Chef Infra Client version: 18.3.0
Chef InSpec version: 5.22.36
Chef CLI version: 5.6.14
Chef Habitat version: 1.6.652
Test Kitchen version: 3.6.0
Cookstyle version: 7.32.2

Environment

Using ubuntu as a client to run kitchen cmds
VERSION="20.04.6 LTS (Focal Fossa)"

Scenario

Trying to run kitchen test to test out windows ec2 instance [infrastructure integration testing].
Converge works fine with this setup.

platforms:
  - name: windows-2016
    os_type: windows
    driver:
      image_id: ami-xxx
      tags:
        Name: Test Runner

However, it breaks when platform is named as below

platforms:
  - name: tr-windows-2016
    os_type: windows
    driver:
      image_id: ami-xxx
      tags:
        Name: Test Runner

OR

platforms:
  - name: tr-2016
    os_type: windows
    driver:
      image_id: ami-xxx
      tags:
        Name: Test Runner

Platform name that began with windows worked just fine while other two breaks which converging itself with same error
Apparently, it creates kitchen folder in the target and process mostly breaks in between while converging and then it complains about folder already exists which was created by itself in the first place.

So this is a bug, even if it expects the platform name to must begin with windows-*, it should throw correct error message in the beginning itself rather than breaking at converge with irrelevant
image

Steps to Reproduce

  • Write kitchen.yml config using ec2 driver for aws
  • Use the platform name as mentioned above
  • Run kitchen create
  • Run kitchen converge

My example config

---
driver:
  name: ec2
  security_group_ids: <%= ENV['GAMI_TEST_SEC_GROUP_ID'] %>
  ssl_verify_peer: true
  region: <%= ENV['GAMI_TEST_REGION'] %>
  instance_type: <%= ENV['GAMI_TEST_INSTANCE_TYPE'] %>
  associate_public_ip: false
  subnet_id: <%= ENV['GAMI_TEST_SUBNET_ID'] %>
  retryable_sleep: 10
  retryable_tries: 120
 
provisioner:
  chef_license: accept-no-persist
  
transport:
  name: winrm
  elevated: true
  username: Administrator


verifier:
  name: inspec
  reporter:
    - cli
    - json-min:test_result_min_%{suite}-%{platform}.json
  
platforms:
  - name: tr-windows-2016
    os_type: windows
    driver:
      image_id: ami-xxx
      tags:
        Name: Test Runner

suites:
  - name: test-suite-1-
    verifier:
      inspec_tests:
        - name: Test-1
          path: ./test/integration/test
    includes:
      - tr-windows-2016

Expected Result

Expected converge to pass

Actual Result

Converge fails.

Failed to complete #converge action: [[WinRM::FS::Core::FileTransporter] Upload failed (exitcode: 0), but stderr present
Cannot create "C:\Users\Administrator\AppData\Local\Temp\kitchen" because a file or directory with the same name already exists.

➕ Additional context

Refer to slack where some discussion was initiated but no resolution.
https://chefcommunity.slack.com/archives/C2B6G1WCQ/p1704982897182869

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

No branches or pull requests

1 participant