1

I was trying to launch windows-2012 instance using kitchen-ec2 for my cookbook and when i try to run kitchen create using the following .kitchen.yml, I am encountering into

undefined method " `username' for nil:NilClass".

I am stuck here at this moment and cannot figure out how to move forward. Any suggestions or advice would be of great help to move forward to launch instance.Thanks for your time.

.kitchen.yml

---
driver:
 name: ec2
 associate_public_ip: false
 aws_ssh_key_id: test-key
 instance_type: t2.medium
 region: us-east-1
 availability_zone: us-east-1c
 subnet_id: subnet-a
 security_group_ids:
  - "sg-a""
transport:
  ssh_key: test.pem
  associate_public_ip: false
  connection_timeout: 60
  connection_retries: 10
provisioner:
  name: chef_zero
  http_proxy: http://proxy.abc.com: 8081
  https_proxy: http://proxy.abc.com: 8081
  no_proxy: "169.254.169.254,amazonaws.com,abc.com"
  environments_path: environments
  roles_path: roles
  require_chef_omnibus: true
  client_rb:
    ssl_verify_mode: :verify_none
    verify_api_cert: false
platforms:
- name: windows-2012
  driver:
    image_id: ami-741c161e
    interface: private
    block_device_mappings:
      - device_name: /dev/sda1
        ebs:
          volume_size: 50
          delete_on_termination: true
          volume_type: gp2
          snapshot_id: snap-120uf
      tags:
        OwnerContact: test
        Name: windows-2012
      transport.username: Administrator
suites:
 - name: default
   run_list:
     - recipe[testing-kitchen]
   kitchen:
   attributes:

verifier:
http_proxy: http://proxy.abc.com:8081
https_proxy: http://proxy.abc.com:8081
no_proxy: "169.254.169.254,amazonaws.com,abc.com"

Error

>>>>>----> Creating <default-windows-2012>...
>>>>>D      Image for default-windows-2012: WIN12R2-x64-HVM-Enc-1603.  Architecture: x86_64, Virtualization: hvm, Storage: ebs gp2, Created: 2016-04-01T03:19:29.000Z
D      No platform detected for WIN12R2-x64-HVM-Enc-1603.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [undefined method `username' for nil:NilClass]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration
StephenKing
  • 36,187
  • 11
  • 83
  • 112
bablu
  • 75
  • 4
  • 11
  • Can you check the `transport.username: Administrator` line? – StephenKing May 04 '16 at 20:05
  • @StephenKing I have moved the username under transport.Now the instance seemed to be created but fails with Message: Failed to complete #create action: [stopped waiting after 60 attempts without success". Not sure if i wanted to modify the values for " connection_timeout: 60, connection_retries: 10" – bablu May 04 '16 at 20:45
  • That's a different issue then. Glad that this one is fixed. – StephenKing May 04 '16 at 21:32
  • Thanks @StephenKing for correcting me on that. – bablu May 05 '16 at 16:09

1 Answers1

1

You probably want to be setting the transport to winrm too.

See https://github.com/poise/poise-boiler/blob/master/lib/poise_boiler/helpers/kitchen.rb#L207-L217 for an example.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • I have updated my kitchen.yml with transport name to winrm, but it's failing with authentication after launching instance. `Retrieved Windows password for instance . EC2 instance ready. [WinRM] connection failed. retrying in 3 seconds: #` – bablu May 05 '16 at 16:08
  • i seemed to corrected that as the default username `Administrator` has been modified to different user, but now it seems to encounter some encoding issues. `D, [2016-05-05T12:34:04.408219 #49115] DEBUG -- Kitchen: Message: Failed to complete #create action: [undefined method `encoding' for nil:NilClass]` – bablu May 05 '16 at 17:36