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

Failed to complete #create action: [undefined method `windows_version_parts' for nil:NilClass] #488

Closed
mmclane opened this issue Apr 16, 2020 · 1 comment

Comments

@mmclane
Copy link

mmclane commented Apr 16, 2020

Version:

(Windows)
Test Kitchen version 1.24.0
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
or
(Linux)
Test Kitchen version 2.4.0
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

[Version of the project installed]

Environment:

I have been trying on both Windows and Linux.

Scenario:

I am trying to use test-kitchen to spin up an AMI I just created with packer and run inspec tests on it. I get an error when it tries to detect the platform.

Steps to Reproduce:

here is my kitchen.yml file

driver:
  name: ec2

provisioner:
  name: shell
  command: 'echo "hellow world!"'

platforms:
  - name: windows
    driver:
      name: ec2
      image_search:
        owner-id: "927623560008"
        name: m3-packer-example-*
      security_group_ids: ["sg-0796fbc3b0b696022"]
      region: us-east-1
      availability_zone: a
      subnet_id: subnet-06677fba897d72122
      instance_type: t2.xlarge
      aws_ssh_key_id: matt-mclane
      retryable_tries: 120
      tags:
        Name: m3-packer-testing
    transport:
      name: winrm
      elevated: true
      ssh_key: /home/mmclane/.ssh/matt-mclane.pem
      username: Administrator

suites:
  - name: default
    run_list:
    verifier:
      inspec_tests:
        - test/default
    attributes:

I run kitchen test

Expected Result:

I expect it to create the instance in ec2

Actual Result:

mmclane@MM-01661:/mnt/c/users/matt.mclane/repos/llamasoft/matt.mclane/packer/sql-servers$ kitchen diagnose --all
Traceback (most recent call last):
30: from /usr/local/bin/kitchen:23:in <main>' 29: from /usr/local/bin/kitchen:23:in load'
28: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/bin/kitchen:13:in <top (required)>' 27: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/errors.rb:171:in with_friendly_errors'
26: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/bin/kitchen:13:in block in <top (required)>' 25: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in start'
24: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in dispatch' 23: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command'
22: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in run' 21: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/cli.rb:142:in diagnose'
20: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/cli.rb:52:in perform' 19: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/command/diagnose.rb:38:in call'
18: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/diagnostic.rb:52:in read' 17: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/diagnostic.rb:125:in prepare_instances'
16: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/diagnostic.rb:125:in each' 15: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/diagnostic.rb:125:in block in prepare_instances'
14: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/instance.rb:257:in diagnose' 13: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/instance.rb:257:in each'
12: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/instance.rb:259:in block in diagnose' 11: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/configurable.rb:120:in diagnose'
10: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/configurable.rb:120:in each' 9: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/configurable.rb:120:in block in diagnose'
8: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/lazy_hash.rb:76:in []' 7: from /var/lib/gems/2.5.0/gems/test-kitchen-2.4.0/lib/kitchen/lazy_hash.rb:143:in proc_or_val'
6: from /var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/ec2.rb:379:in default_ami' 5: from /var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/aws/standard_platform.rb:106:in find_image'
4: from /var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/aws/standard_platform.rb:224:in sort_images' 3: from /var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/aws/standard_platform/windows.rb:65:in sort_by_version'
2: from /var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/aws/standard_platform/windows.rb:65:in group_by' 1: from /var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/aws/standard_platform/windows.rb:65:in each'
/var/lib/gems/2.5.0/gems/kitchen-ec2-3.4.0/lib/kitchen/driver/aws/standard_platform/windows.rb:65:in block in sort_by_version': undefined method windows_version_parts' for nil:NilClass (NoMethodError)

@mmclane
Copy link
Author

mmclane commented Apr 16, 2020

I sorted this out. I believe I needed to have 'windows' in the AMI name somewhere. Once I renamed it from m3-packer-test-{timestamp} to m3-packer-windows-{timestamp} it started working.

@mmclane mmclane closed this as completed Apr 16, 2020
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