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

Doesn't work after upgrading to 0.1.2 #83

Closed
morgoth opened this issue Apr 8, 2015 · 38 comments
Closed

Doesn't work after upgrading to 0.1.2 #83

morgoth opened this issue Apr 8, 2015 · 38 comments

Comments

@morgoth
Copy link

morgoth commented Apr 8, 2015

I'm getting error:

rake aborted!
NameError: uninitialized constant Fog::Service
ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/storage.rb:3:in `<module:Storage>'
ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/storage.rb:2:in `<module:Fog>'
ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/storage.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler/runtime.rb:76:in `require'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler/runtime.rb:72:in `each'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler/runtime.rb:72:in `block in require'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler/runtime.rb:61:in `each'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler/runtime.rb:61:in `require'
/usr/local/rvm/gems/ruby-2.2.0@global/gems/bundler-1.7.9/lib/bundler.rb:134:in `require'
releases/20150408132737/config/application.rb:7:in `<top (required)>'
releases/20150408132737/Rakefile:4:in `require'
releases/20150408132737/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
---- End output of bash -c 'source /etc/profile.d/rvm.sh && bundle exec rake assets:precompile' ----

I'm using https://github.com/rumblelabs/asset_sync gem - not sure if this issue should be addressed there or here.

@plribeiro3000
Copy link
Member

Damm. Try changing this:

gem "fog", "~>1.20", require: "fog/aws/storage"
gem "asset_sync"

to:

gem "fog-aws"
gem "asset_sync"

EDIT: If it works i will send a PR to asset_sync right away.

@morgoth
Copy link
Author

morgoth commented Apr 8, 2015

yes, it's working fine after this change

@plribeiro3000
Copy link
Member

Awesome. I will send a PR.

@plribeiro3000
Copy link
Member

@morgoth Take a look at my PR: AssetSync/asset_sync#299

@asanger
Copy link

asanger commented Apr 8, 2015

I'm running into an issue as well that just started happening today:

NameError: uninitialized constant Fog::AWS::CredentialFetcher

I assume it's related.

This is using the Route53 Chef Cookbook found here: https://supermarket.chef.io/cookbooks/route53

@nobeh
Copy link

nobeh commented Apr 8, 2015

Same here as we're experiencing the same in OpsWorks as update to fog-aws 0.1.2.

@plribeiro3000
Copy link
Member

@asanger Where is the code related to that plugin?
I believe the issue is the same. It is requiring some internal file of fog.

@asanger
Copy link

asanger commented Apr 8, 2015

I don't think that it's hosted on Github, but hopefully tagging @webframp and @slyness will help get this resolved.

Maybe it's just an update to default['route53']['fog_version'] = '1.27'

@geemus
Copy link
Member

geemus commented Apr 8, 2015

@plribeiro3000 maybe we should add a file back to fog-aws in the expected location (which just requires the new location). That way we won't have to chase down all the unusual usage elsewhere. What do you think?

@plribeiro3000
Copy link
Member

Yeah. It makes sense @geemus. Im just not sure which file.

Em qua, 8 de abr de 2015 12:28, Wesley Beary notifications@github.com
escreveu:

@plribeiro3000 https://github.com/plribeiro3000 maybe we should add a
file back to fog-aws in the expected location (which just requires the new
location). That way we won't have to chase down all the unusual usage
elsewhere. What do you think?


Reply to this email directly or view it on GitHub
#83 (comment).

@geemus
Copy link
Member

geemus commented Apr 8, 2015

Got it. I'd guess fog/aws or fog/aws/storage, similar to what you note above, but hard to know.

@plribeiro3000
Copy link
Member

@geemus On fog-aws i did no move any file. Just removed some unnecessary requires (in the context of a gem) since all services are defined when the gem is first loaded. So a simple list of the gem in the Gemfile will define all services without require any extra file.

The issue seems to be that both asset_sync and OpsWorks were loading the storage file directly. And it was working before because of the require.

I believe that as a short workaround we can add the require 'fog-core' back to the service files but as a long run i think the best would be to update this services to get the advantages of the new architecture of fog (1 gem for each provider). I think that since we have self contained providers on its own gems there is no more sense to be requiring files by hand.

@geemus @tokengeek Toughs? Perhaps i'm wrong.

I will take a look at the route53 cookbook and see if it can be easily fixed.

@geemus
Copy link
Member

geemus commented Apr 9, 2015

Sounds reasonable, worth a try anyway.

@tomalessi
Copy link

I'm experiencing the same issue using the Route53 recipe with OpsWorks - it's happening since we upgraded to Amazon Linux 2015.03.

Updating default['route53']['fog_version'] = '1.27' to '1.29' does not help.

Error specifics from OpsWorks logs:

NameError

uninitialized constant Fog::AWS::CredentialFetcher

Cookbook Trace:

/var/lib/aws/opsworks/cache.stage2/cookbooks/route53/providers/record.rb:82:in require' /var/lib/aws/opsworks/cache.stage2/cookbooks/route53/providers/record.rb:82:inblock in class_from_file'

@plribeiro3000
Copy link
Member

@tomalessi I believe the issue is not in fog-aws itself. Which version of route53 cookbook are you using?

Any version prior to 0.3.5 won't work with version 0.1.2 of fog-aws.
For a better understanding take a look at this require in version 0.3.5. All versions of route53 cookbook are doing the correct require.

Could you try to update your version of route53 cookbook and see the results of it?

@asanger
Copy link

asanger commented Apr 10, 2015

I can confirm that I am getting the same error as @tomalessi on Amazon Linux 2015.03. Rolling back to Amazon Linux 2014.09 allows me to use the gem without error.

@plribeiro3000
Copy link
Member

@asanger Perhaps you can provide us more information about those machines like diference between both. As i could find on the blog post there is no much that could be the culprit. This would help us track down further issues and perhaps even this one.

@plribeiro3000
Copy link
Member

As a PR for asset_sync is already proposed with documentation fixes i believe the first issue in here might be fine. As for the second it does not seems to be related to the lib itself so i'm closing this.

Comment back here or reopen if you think this issue still exists.

Thanks!

@plribeiro3000
Copy link
Member

@morgoth @asanger Is asset_sync still maintained? Because i can see a lot of open issues and PR's and no activity at all for the last 4-5 months.
If thats the case i believe there no much we can do to fix it.

@threadhead
Copy link

@plribeiro3000 I'm getting the same error with CarrierWave.

/Users/karl/.rvm/gems/ruby-2.2.1/gems/fog-aws-0.1.2/lib/fog/aws/storage.rb:3:in `<module:Storage>': uninitialized constant Fog::Service (NameError)

I fixed it by downgrading fog-aws

gem 'fog-aws', '<= 0.1.1', require: false
gem 'fog', require: "fog/aws/storage"

@plribeiro3000
Copy link
Member

@threadhead Take a look at carrierwaveuploader/carrierwave#1620 and carrierwaveuploader/carrierwave#1625. They should fix that issue.

As for now, if you update your carrrierwave dependency to the latest master and change the initializer block it should work without this patch you just made.

Put in Gemfile:

gem 'fog-aws'
# No need for fog if you are using only `fog-aws`

In the initializer:

CarrierWave.configure do |config|
    config.fog_provider = 'fog-aws'
    # your other configuration keys
end

@benholtz
Copy link

@plribeiro3000 I'm getting the uninitialized constant Fog::AWS::CredentialFetcher while using the route53 module, any ideas what I can do to work around it?

@plribeiro3000
Copy link
Member

@benholtz Yeah. It would be awesome if we can get more information to help debug.

  • When exactly is this exception being raised?
  • Which line of which file is raising it?
  • part of the related code raising it as well.
  • both versions of route53 and fog-aws
  • Your Gemfile
  • The command you are running
  • The gems installed ins your system
  • The cookbooks installed in your system

Provide as much information as you can so we can do a better investigation. Thanks in advance for your time doing it!

@plribeiro3000 plribeiro3000 reopened this Apr 21, 2015
@JamesClonk
Copy link

I'm getting the same error when using the bosh-cli (https://github.com/cloudfoundry/bosh/tree/master/bosh_cli):

[my_user@my_host]$ bundle exec bosh micro deploy bosh-stemcell-2922-openstack-kvm-ubuntu-trusty-go_agent.tgz
/home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:6:in `<class:AutoScaling>': uninitialized constant Fog::AWS::CredentialFetcher (NameError)
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:5:in `<module:AWS>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:4:in `<module:Fog>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:3:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog/aws.rb:2:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog/aws.rb:2:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog.rb:23:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog.rb:23:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/bosh-registry-1.2922.0/lib/bosh/registry.rb:10:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/bosh-registry-1.2922.0/lib/bosh/registry.rb:10:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/bosh-registry-1.2922.0/bin/bosh-registry:3:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/bosh-registry-1.2922.0/bin/bosh-registry:3:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/bin/bosh-registry:23:in `load'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/bin/bosh-registry:23:in `<main>'

And also in one of my own ruby scripts:

[my_user@my_host]$ bundle exec ruby my_script.rb
/home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:6:in `<class:AutoScaling>': uninitialized constant Fog::AWS::CredentialFetcher (NameError)
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:5:in `<module:AWS>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:4:in `<module:Fog>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:3:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog/aws.rb:2:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog/aws.rb:2:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog.rb:23:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog.rb:23:in `<top (required)>'
        from /home/my_user/my_script.rb:1:in `require'
        from /home/my_user/my_script.rb:1:in `<top (required)>'

[my_user@my_host]$ head my_script.rb
require 'fog'
require 'fog/openstack'
require 'ipaddr'

module ...

So, I try fixing it by adding `require 'fog/aws' to it, but then I get the uninitialized constant Fog::Service error:

/home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:5:in `<module:AWS>': uninitialized constant Fog::Service (NameError)
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:4:in `<module:Fog>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-aws-0.1.2/lib/fog/aws/auto_scaling.rb:3:in `<top (required)>'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog/aws.rb:2:in `require'
        from /home/my_user/.vendor/bundle/ruby/2.2.0/gems/fog-1.27.0/lib/fog/aws.rb:2:in `<top (required)>'
        from /home/my_user/my_script.rb:1:in `require'
        from /home/my_user/my_script.rb:1:in `<top (required)>'
        from ci/apcctl.rb:4:in `require'
        from ci/apcctl.rb:4:in `block in <main>'
        from ci/apcctl.rb:4:in `each'
        from ci/apcctl.rb:4:in `<main>'

[my_user@my_host]$ head my_script.rb
require 'fog/aws'
require 'fog'
require 'fog/openstack'
require 'ipaddr'

module ...

I've been working around this issue so far by adding require_relative('.') to fog/aws/auto_scaling.rb, but that's not really satisfying obviously.

@geemus
Copy link
Member

geemus commented Apr 27, 2015

@JamesClonk could you try bumping the fog version? That one is a couple old and appears at least at times to be referring to files that no longer exist. Thanks!

@MikeStankavich
Copy link

Did anybody ever bottom out on this? I ran into the same thing with Opsworks and the route53 chef recipe. I'm using Ubuntu 14.04. The very strange thing is that it works on a small instance, but fails on a medium. That makes absolutely no sense at all to me, because as far as I can tell the source AMI (I'm using the stock image) is the same either way. I'll be glad to document anything needed to help sort this out.

I'm using route53 0.4.0, and I also tried a fog-aws based fork from https://github.com/josacar/route53.

The interesting thing, which hopefully might be a clue, is that I got a different error message from josacar/s fork. It's returning uninitialized constant Fog::Service instead of uninitialized constant Fog::AWS::CredentialFetcher


Message from josacar branch

Error executing action create on resource 'route53_record[opsworks-solr-test.avalonhq.com]'

NameError

uninitialized constant Fog::Service

Cookbook Trace:

/var/lib/aws/opsworks/cache.stage2/cookbooks/route53/providers/record.rb:82:in require' /var/lib/aws/opsworks/cache.stage2/cookbooks/route53/providers/record.rb:82:inblock in class_from_file'

@geemus
Copy link
Member

geemus commented May 1, 2015

@MikeStankavich are you on latest versions of fog and fog-aws? I think there is some historical conflict due to changes that if one got bumped without the other getting bumped it could end up in a situation similar to this.

@MikeStankavich
Copy link

Sorry to say that didn't help. I was able to change the required version on the route53 recipe from fog-aws-0.1.1 to fog-aws-0.1.2, but the result is the same. Here's the log output showing the gem versions and the error.


[2015-05-01T16:45:17+00:00] INFO: Processing chef_gem[fog-aws] action install (route53::default line 22)
[2015-05-01T16:45:17+00:00] INFO: Installing chef-gem fog-aws = 0.1.2
(snip)
Successfully installed fog-core-1.30.0
Successfully installed fog-json-1.0.1
Successfully installed fog-xml-0.1.2
Successfully installed fog-aws-0.1.2
7 gems installed

(snip)

[2015-05-01T16:45:28+00:00] INFO: Processing chef_gem[fog-aws] action install (route53::default line 22)
[2015-05-01T16:45:28+00:00] INFO: Processing log[Host name: opsworks-solr-test.avalonhq.com] action write (qk-search::configure line 21)
[2015-05-01T16:45:28+00:00] INFO: Host name: opsworks-solr-test.avalonhq.com
[2015-05-01T16:45:28+00:00] INFO: Processing log[IP address: 52.8.115.199] action write (qk-search::configure line 25)
[2015-05-01T16:45:28+00:00] INFO: IP address: 52.8.115.199
[2015-05-01T16:45:28+00:00] INFO: Processing route53_record[opsworks-solr-test.avalonhq.com] action create (qk-search::configure line 29)

Error executing action create on resource 'route53_record[opsworks-solr-test.avalonhq.com]'

NameError

uninitialized constant Fog::Service

Cookbook Trace:

/var/lib/aws/opsworks/cache.stage2/cookbooks/route53/providers/record.rb:82:in require' /var/lib/aws/opsworks/cache.stage2/cookbooks/route53/providers/record.rb:82:inblock in class_from_file'

Resource Declaration:

In /var/lib/aws/opsworks/cache.stage2/cookbooks/qk-search/recipes/configure.rb

29: route53_record "create a record" do
30: name hostname
31: value ip_addr
32: type "A"
33: zone_id node[:route53][:zone_id]
34: aws_access_key_id node[:route53][:aws_access_key_id]
35: aws_secret_access_key node[:route53][:aws_secret_access_key]
36: overwrite true
37: action :create
38: end

@kerr23
Copy link

kerr23 commented May 4, 2015

Howdy all. I was getting the same error
`module:AWS': uninitialized constant Fog::Service (NameError)
it seems like it would have thrown on anything under fog/aws since they all inherit from Fog::Service

To clean mine up i had to 'gem clean' now it's working.

@plribeiro3000
Copy link
Member

@kerr23 Awesome!

@morgoth @asanger @nobeh @tomalessi @threadhead @benholtz @JamesClonk @MikeStankavich Could you guys try @kerr23 solution?

gem clean

Thanks!

@geemus
Copy link
Member

geemus commented May 4, 2015

Oh man, I didn't even consider that. I could see how it might complicate things though. @kerr23 thanks for the pro-tip!

@MikeStankavich
Copy link

I spent a few happy hours attacking this issue today. gem clean did not help me, but what finally did work was going back to the main line route53 recipe https://github.com/hw-cookbooks/route53 and overriding the version attribute to force it to use fog 1.29.0 instead of fog 1.27.0.

@geemus
Copy link
Member

geemus commented May 5, 2015

@MikeStankavich sorry to hear it caused so much trouble, but thanks for taking the time to share your findings. I'm hoping to make some more changes to improve the situation moving forward, but I think part of this has to do with the way in which the releases happen (so maybe not possible to go back and change it particularly).

@palexvs
Copy link

palexvs commented May 16, 2015

I have the same issue on ci.solanolabs.com, but everything works in my dev and prod environment, very strange.

fog (1.30.0)

Hack that helps me:

change

gem 'fog', require: 'fog/aws/storage'
gem 'asset_sync'

to

gem 'fog'
gem 'asset_sync'

@plribeiro3000
Copy link
Member

@palexvs

You should be using:

gem `fog-aws` # without the custom require.
gem `asset_assync`

The issue here is that this custom require was an old workaround to decrease the amount of stuff loaded from fog. Since we are heading to a gem based architecture now, there is no reason to keep doing that. Bundler will do that now.

@bshehram
Copy link

bshehram commented Sep 3, 2015

I had this exact same issue. Using OpsWorks with the latest 03.2015 Amazon Linux AMI. I have my custom cookbook that is calling route53 0.4.0. I tried the fixes listed above what finally got me working was forcing the version of fog to be 1.33.0 (the current latest). I did this by putting in the following line in my custom cookbook's attributes/default.rb file:

default['route53']['fog_version'] = '1.33.0'

Cheers!

@benholtz
Copy link

wound up fixing this in April by moving to the Ruby AWS SDK for route53 management.

@vassav-nn
Copy link

Try add in OpsWorks "Custom JSON":
"route53":{"fog_version":"1.33.0"}

@morgoth morgoth closed this as completed Nov 14, 2015
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

Successfully merging a pull request may close this issue.