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

Weird undefined method error #265

Open
dfduarte opened this issue Apr 25, 2017 · 6 comments
Open

Weird undefined method error #265

dfduarte opened this issue Apr 25, 2017 · 6 comments

Comments

@dfduarte
Copy link

dfduarte commented Apr 25, 2017

Hello,

I was running Kitchen with Docker plugin to try it and make some convergence tests. For some reason, my Kitchen died at some point and Docker started to spit some coredumps out with Kitchen.

After a reboot, Docker is back but Kitchen shows this message for every execution using the kitchen-docker

bash-3.2$ KITCHEN_DRIVER=docker chef exec kitchen converge
-----> Starting Kitchen (v1.15.0)
-----> driver_plugin: docker
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/data_munger.rb:367:in `convert_legacy_driver_format_at!': undefined method `rmerge' for nil:NilClass (NoMethodError)
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/data_munger.rb:344:in `convert_legacy_driver_format!'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/data_munger.rb:42:in `initialize'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:152:in `new'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:152:in `data'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:131:in `suites'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:182:in `filter_instances'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:141:in `build_instances'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/config.rb:117:in `instances'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:112:in `filtered_instances'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command.rb:142:in `parse_subcommand'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command/action.rb:35:in `block in call'
	from /opt/chefdk/embedded/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/command/action.rb:34:in `call'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:53:in `perform'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:187:in `block (2 levels) in <class:CLI>'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/cli.rb:334:in `invoke_task'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/bin/kitchen:13:in `block in <top (required)>'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/lib/kitchen/errors.rb:171:in `with_friendly_errors'
	from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/test-kitchen-1.15.0/bin/kitchen:13:in `<top (required)>'
	from /opt/chefdk/bin/kitchen:21:in `load'
	from /opt/chefdk/bin/kitchen:21:in `<main>'

What could be done to solve this?

Note: Any other plugins, like kitchen-vagrant and kitchen-ec2 works well.

My local system runs a MacOS Sierra with latest kitematic installed.

@coderanger
Copy link
Contributor

Please paste in your kitchen.yml.

@dfduarte
Copy link
Author

Reinstalling kitchen-docker didn't work. I'm reinstalling the whole kitematic right now.

Meanwhile:

---
<%
  #--------------------------------------------------------------------------
  # the driver_plugin can be over_plugin can be overridden with an environment variable:
  #   $ KITCHEN_DRIVER=ec2 kitchen test
  # if not specified, defaults are used...
  #   - kitchen_driver_ci if environment variable CI=true is present
  #   - kitchen_driver_local is used otherwise (which defaults to vagrant)
  #--------------------------------------------------------------------------
  kitchen_driver_ci = 'ec2'
  kitchen_driver_local = 'vagrant'
  kitchen_driver_docker = 'docker'
  kitchen_driver_default = kitchen_driver_local
  if ENV['KITCHEN_DRIVER']
    kitchen_driver = ENV['KITCHEN_DRIVER']
  elsif ENV['CI']=="true"
    kitchen_driver = kitchen_driver_ci
  else
    kitchen_driver = kitchen_driver_default
  end
  puts "-----> driver_plugin: #{kitchen_driver.to_s}"
%>

driver_plugin: <%= kitchen_driver %>
driver_config:
  <% if kitchen_driver == 'ec2' %>
  require_chef_omnibus: true
  aws_access_key_id:      <%= ENV['AWS_ACCESS_KEY_ID'] %>
  aws_secret_access_key:  <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
  aws_ssh_key_id:         <%= ENV['AWS_SSH_KEY_ID']         || "kitchen-circleci" %>
  region:                 <%= ENV['AWS_REGION']             || "us-east-1" %>
  availability_zone:      <%= ENV['AWS_AVAILABILITY_ZONE']  || "us-east-1b" %>
  instance_type: "t2.medium"
  security_group_ids: ["sg-e7c18b9d"]
  subnet_id: "subnet-616eff4a"
  vpc_id: "vpc-69201b0c"
  associate_public_ip: false
  <% end %>
  <% if kitchen_driver == 'vagrant' %>
  customize:
    memory: 2048
  <% end %>

<% if kitchen_driver == 'ec2' %>
transport:
  ssh_key: /home/ubuntu/.ssh/xxxxxxxxxxxxxx
  username: centos
<% end %>

provisioner:
  name: chef_zero
  # chef_omnibus_url: https://jaxf-github.xxxxxxx.corp/raw/devops/ci-standards/master/test-kitchen/chef/install-chef.sh
  http_proxy: http://xxxxxxxxxx:3128
  https_proxy: https://xxxxxxxxxxxxx:3128

verifier:
  name: inspec
  sudo: false

platforms:
- name: centos-7.2
  <% if kitchen_driver == 'ec2' %>
  driver_config:
    image_id: ami-ea61fxxx
    tags: { "Name": "xxxxxxxxxxxxxxxxxxx" }
  <% end %>
  <% if kitchen_driver == 'docker' %>
  driver_config:
    image: centos:7
    platform: centos
    use_sudo: false
    privileged: true
    provision_command:
    - curl -L https://www.chef.io/chef/install.sh | bash
    # - apt-get install -y net-tools
  <% end %>

suites:
- name: default
  run_list:
    - recipe[xxxxxxx_pdns::default]
  verifier:
    inspec_tests:
        - test/recipes
  attributes:

(note: some infos, like tags and keys were stripped off of kitchen.yml, for the sake of confidentiality)

@coderanger
Copy link
Contributor

That is a super deprecated config style, fix that :) It should look more like this:

driver:
  name: <%= kitchen_driver %>
  <% if kitchen_driver == 'ec2' %>
  stuff

@coderanger
Copy link
Contributor

Also if you want to see a more structure approach to a highly dynamic kitchen config, look at poise-boiler.

@dfduarte
Copy link
Author

@coderanger oh thanks for the tip... I'll check ASAP. Do you think that this issue could be related to the issue?

Btw, still dead. My docker ver here is:

bash-3.2$ docker version
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.3
 Git commit:   a34a1d5
 Built:        Fri Nov 20 17:56:04 UTC 2015
 OS/Arch:      darwin/amd64

Server:
 Version:      17.04.0-ce
 API version:  1.28
 Go version:   go1.7.5
 Git commit:   4845c56
 Built:        2017-04-05T18:45:47.678223209+00:00
 OS/Arch:      linux/amd64

@coderanger
Copy link
Contributor

No, you can see the error is in convert_legacy_driver_format!. You probably have some malformed Yaml in all that dynamic code.

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

2 participants