chef-provisioning-aws icon indicating copy to clipboard operation
chef-provisioning-aws copied to clipboard

Error when converging cookbooks depending on 'aws' cookbook

Open esciara opened this issue 10 years ago • 15 comments

Whenever a cookbook using the chef-provisioning-aws driver depends on the 'aws' cookbook, converging fails at cookbooks compilation time with the following error:

[..]
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:  
[..]

Full instructions on https://gist.github.com/esciara/d0921bded64568dc6424

This stops me completly from deploying cookbooks such as https://github.com/bflad/chef-confluence .

esciara avatar Jan 26 '15 00:01 esciara

That gist is missing

Jimflip avatar Jan 27 '15 10:01 Jimflip

@Jimflip sorry... had left a '/edit' in the link. Corrected now, you should be able to access it

esciara avatar Jan 27 '15 10:01 esciara

The aws LWRP is going to create these resources:

Chef::Resource::AwsEbsRaid             
Chef::Resource::AwsEbsVolume           
Chef::Resource::AwsElasticIp           
Chef::Resource::AwsElasticLb           
Chef::Resource::AwsInstanceMonitoring  
Chef::Resource::AwsResourceTag

of which AwsEbsVolume is going to have the superclass conflict. Not sure how to work around that.

pburkholder avatar Feb 03 '15 17:02 pburkholder

Yep, we had a discussion around that on https://gitter.im/chef/chef-provisioning/archives/2015/01/27 and PR #70 has been created to fix this.

Another solution is not to use the https://github.com/opscode-cookbooks/aws cookbook. I don't really understand how it is called in the cookbook I am using (https://github.com/bflad/chef-confluence) since, from what I can see, it is only referred to in dependencies with suggest or recommend, and not depends. Need to dig a little deeper...

esciara avatar Feb 03 '15 18:02 esciara

I saw in Gitter that you'd asked about how the 'aws' cookbook creates the Chef::Resource::AwsEbsVolume class. That's part of the LWRP magic, e.g. http://www.rubydoc.info/github/opscode/chef/Chef/Resource/LWRPBase, which takes the names you're providing in the LWRP and generates Chef::Resource::CookbooknameResourceName resources.

Since the cookbook is 'aws' and the resource is 'ebs_volume' you got AwsEbsVolume from this file: https://github.com/opscode-cookbooks/aws/blob/master/resources/ebs_volume.rb

pburkholder avatar Feb 03 '15 19:02 pburkholder

Thanks @pburkholder . I ended up working this out but did not have any reference, which you now gave!

esciara avatar Feb 03 '15 22:02 esciara

I think we should close this, per the discussion in #70. The AWS cookbook and this have a name collision you shouldn't use both in the same cookbook dependency chain until the functionality of the two are merged.

pburkholder avatar Feb 21 '15 04:02 pburkholder

I do wonder ... what if we modified the aws cookbook so it used chef-provisioning, and made sure we supported the same attributes?

jkeiser avatar Feb 21 '15 06:02 jkeiser

Our answer for this at the moment is indeed "at 1.0, you should not use both at the same time." I'd like to see if we can find a way through, so leaving it open at the moment and putting milestone=Later.

jkeiser avatar Feb 26 '15 06:02 jkeiser

Is any progress being made on this ? I am trying to converge a node that will be the provisioning node running chef-provisioning-aws recipes to create all the other servers in the local infrastructure. I need to use the aws cookbook for the aws_s3_file lwrp to retrieve files from S3 when converging my provisioning server. I like @jkeiser's suggestion of implementing the aws cookbook using chef-provisioning. Is anyone actually working on a solution at this time ?

robcoward avatar Jun 12 '15 17:06 robcoward

@robcoward The Chef Provisioning team sat down to hash out a pathway forward. #223 is a step toward making this a reality, but it may be a short while before we get there.

Perhaps we should close this (per #70 and #223)? The aws_ebs_volume and aws_eip_address resources should round out the things we need to cannibalize out of the aws cookbook.

gmiranda23 avatar Jun 18 '15 01:06 gmiranda23

Hi @gmiranda23, as a work around for now, I have implemented the aws_s3_file lwrp in my own cookbook to remove the aws cookbook dependency, so I'll be keeping a close eye on #223. I don't see any problem in closing this issue given the team has a plan moving forward. Thanks for all the hard work :-)

robcoward avatar Jun 18 '15 05:06 robcoward

This is sloppy, this is what's driving people from Chef. You guys maintain BOTH repositories.

magicaltrevor avatar Oct 01 '15 17:10 magicaltrevor

@gmiranda23 @jkeiser any update on this? haven't seen any movement in over a year

shortdudey123 avatar Aug 29 '16 22:08 shortdudey123

Is there any progress at all on this? over 2 years from the time this issue was noticed...

joemoore13 avatar Apr 18 '17 20:04 joemoore13