You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have upgraded my Chef DK from version 1.0.3 to 2.1.11 and Ruby from 2.0.0 to ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
Since that the Windows EC2 instance launch fails with Failed to complete #create action: [undefined method `version' for nil:NilClass] on default-windows-2012r2
I can successfully launch RHEL7 EC2 instance with the same .kitchen.yml.
I suspect this is the line that fails: if actual_platform.version =~ /2016/
The actual_platform is nil when the code is executed.
The kitchen diagnose --all output is
/Users/USER/.chefdk/gem/ruby/2.4.0/gems/kitchen-ec2-1.3.2/lib/kitchen/driver/ec2.rb:558:in `default_windows_user_data': undefined method `version' for nil:NilClass (NoMethodError)
from /Users/pinterl/.chefdk/gem/ruby/2.4.0/gems/kitchen-ec2-1.3.2/lib/kitchen/driver/ec2.rb:62:in `block in <class:Ec2>'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/lazy_hash.rb:135:in `proc_or_val'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/lazy_hash.rb:76:in `[]'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/configurable.rb:119:in `block in diagnose'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/configurable.rb:119:in `each'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/configurable.rb:119:in `diagnose'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/instance.rb:245:in `block in diagnose'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/instance.rb:243:in `each'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/instance.rb:243:in `diagnose'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/diagnostic.rb:125:in `block in prepare_instances'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/diagnostic.rb:125:in `each'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/diagnostic.rb:125:in `prepare_instances'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/diagnostic.rb:52:in `read'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/command/diagnose.rb:38:in `call'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/cli.rb:53:in `perform'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/cli.rb:143:in `diagnose'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/cli.rb:334:in `invoke_task'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/bin/kitchen:13:in `block in <top (required)>'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/lib/kitchen/errors.rb:171:in `with_friendly_errors'
from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/test-kitchen-1.17.0/bin/kitchen:13:in `<top (required)>'
from /usr/local/bin/kitchen:263:in `load'
from /usr/local/bin/kitchen:263:in `<main>'
My Chef version is
chef --version
Chef Development Kit Version: 2.1.11
chef-client version: 13.2.20
delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427)
berks version: 6.3.0
kitchen version: 1.17.0
inspec version: 1.33.1
driver:
name: ec2
region: us-east-1
availability_zone: c
subnet_id: MY_SUBNET
aws_ssh_key_id: MY_KEY
require_chef_omnibus: true
associate_public_ip: false
retryable_tries: 120
retryable_sleep: 5
tags:
Name: TK_instance-utils_cookbook
provisioner:
name: chef_zero
verifier:
name: inspec
platforms:
- name: windows-2012r2
driver:
image_id: "ami-c8d56fde" #This value will be specific to dev or CI environment
instance_type: m3.medium #Can be changed to any AWS instance size
security_group_ids: ['MY_SG']
tags:
Application-Role: MSW12R2|App
transport:
name: winrm
elevated: true # Required for the installation of some Windows features
connection_timeout: 60
connection_retries: 10
username: MY_USER #This value will be specific to dev or CI environment
password: MY_PASSWORD #This value will be specific to dev or CI environment
- name: rhel7
driver:
image_id: "ami-9534ad82" #This value will be specific to dev or CI environment
instance_type: m3.medium #Can be changed to any AWS instance size
block_device_mappings:
- device_name: /dev/sda1
ebs:
volume_type: standard
volume_size: 100
delete_on_termination: true
security_group_ids: [ 'MY_SG' ] #This value will be specific to dev or CI area
tags:
Application-Role: RHL7|App
transport:
ssh_key: ~/.aws/MY_KEY.pem #This value will be specific to dev or CI environment
connection_timeout: 60
connection_retries: 10
username: ec2-user
suites:
- name: default
data_bags_path: "data_bags"
encrypted_data_bag_secret_key_path: "../../data_bags/encrypted_data_bag_secret"
verifier:
inspec_tests:
- test/recipes
run_list:
- recipe[utils::default]
attributes:
set_hostname: "TK_cookbook"
I am actually seeing the same issue, upgraded my chefdk as well to be sure it wasn't something solved in an update. I have tried various combinations of the platform name as well.
Just had this as well trying to use a custom AMI. It was because the AMI name has to conform to a naming convention so that the OS version can be extracted ("Windows 2016"). #230 covers the requirement for a better error message.
Also ran into this issue with a custom Windows AMI, @rlaveycal is right. Had to copy the existing AMI into a new AMI, since "AMI Name" isn't editable. Specifying the new "AMI Name" as windows-2012r2 worked fine in Kitchen.
Closing this one as it isn't a bug per-say so much as non-informative error messages as covered by #230 - closing this one since it's not quite a bug and we're tracking the work to make this clearer in #230.
I have upgraded my Chef DK from version 1.0.3 to 2.1.11 and Ruby from 2.0.0 to ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
Since that the Windows EC2 instance launch fails with
Failed to complete #create action: [undefined method `version' for nil:NilClass] on default-windows-2012r2
I can successfully launch RHEL7 EC2 instance with the same .kitchen.yml.
I suspect this is the line that fails:
if actual_platform.version =~ /2016/
The actual_platform is nil when the code is executed.
The kitchen diagnose --all output is
My Chef version is
Ruby version
My .kitchen.yml file is
The Gem list is
The text was updated successfully, but these errors were encountered: