Skip to content

Instantly share code, notes, and snippets.

@esciara
Last active August 29, 2015 14:14
Show Gist options
  • Save esciara/d0921bded64568dc6424 to your computer and use it in GitHub Desktop.
Save esciara/d0921bded64568dc6424 to your computer and use it in GitHub Desktop.
Demonstrates a bug when using the chef-provisioning-aws driver in a cookbook that depends on the aws cookbook

See chef-boneyard/chef-provisioning-aws#68

To reproduce the bug be sure you have the following tree in your cookbook development directory:

|_.chef
| |_knife.rb
|_recipes
| |_default.rb
|_Berksfile
|_Gemfile
|_metadata.rb

Then run the following commands

$ bundle install
$ bundle exec berks vendor cookbooks
$ bundle exec chef-client -z -o aws-bug-cookbook::default

You will have the following error message:

[..]
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /path/to/your/cookbook/development/directory/.chef/local-mode-cache/cache/cookbooks/aws-bug-cookbook/recipes/default.rb
================================================================================

TypeError
---------
superclass mismatch for class AwsEbsVolume

Cookbook Trace:
---------------
  /path/to/your/cookbook/development/directory/.chef/local-mode-cache/cache/cookbooks/aws-bug-cookbook/recipes/default.rb:15:in `require'
  /path/to/your/cookbook/development/directory/.chef/local-mode-cache/cache/cookbooks/aws-bug-cookbook/recipes/default.rb:15:in `from_file'

Relevant File Content:
----------------------
/path/to/your/cookbook/development/directory/.chef/local-mode-cache/cache/cookbooks/aws-bug-cookbook/recipes/default.rb:

  8:  #
  9:  # Licensed under the Apache License, Version 2.0 (the "License");
 10:  # you may not use this file except in compliance with the License.
 11:  # You may obtain a copy of the License at
 12:  #
 13:  #     http://www.apache.org/licenses/LICENSE-2.0
 14:  
 15>> require 'chef/provisioning/aws_driver'
 16:  with_driver 'aws'
 17:  
[..]
source 'https://supermarket.chef.io'
metadata
require 'chef/provisioning/aws_driver'
with_driver 'aws'
source 'https://rubygems.org'
gem 'berkshelf', '~> 3.2.3'
gem 'chef-dk', '0.3.5'
gem 'chef-provisioning', '0.17'
gem 'chef-provisioning-aws', '0.1.3'
# This file exists mainly to ensure we don't pick up knife.rb from anywhere else
config_dir "#{File.expand_path('..', __FILE__)}/" # Wherefore art config_dir, chef?
private_key_paths [ File.expand_path('./.chef/keys', ENV["HOME"]) ]
# Chef 11.14 binds to "localhost", which interferes with port forwarding on IPv6 machines for some reason
begin
chef_zero.host '127.0.0.1'
rescue
end
name 'aws-bug-cookbook'
maintainer 'Emmanuel Sciara'
maintainer_email 'emmanuel.sciara@gmail.com'
license 'Apache 2.0'
description 'Demonstrates chef-provisioning-aws bug with aws cookbook'
long_description 'Demonstrates a bug, which appears when using chef-provisioning-aws in a cookbook depending on the aws cookbook'
version '0.1.0'
depends 'aws'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment