尝试使用kitchen-ec2启动Windows实例时nil的未定义用户名:nilclass

时间:2016-05-04 19:48:47

标签: chef aws-ec2 test-kitchen

我尝试使用kitchen-ec2为我的食谱启动windows-2012实例,当我尝试使用以下kitchen create运行.kitchen.yml时,我遇到了

  

未定义的方法" `用户名'为零:NilClass"。

此刻我被困在这里,无法弄清楚如何前进。任何建议或建议对推进实例都有很大帮助。谢谢你的时间。

.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"

错误

>>>>>----> 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

1 个答案:

答案 0 :(得分:1)

您可能希望将传输设置为winrm

有关示例,请参阅https://github.com/poise/poise-boiler/blob/master/lib/poise_boiler/helpers/kitchen.rb#L207-L217