poise / poise-ruby-build

A ruby-build provider for the poise-ruby cookbook.
Apache License 2.0
5 stars 5 forks source link

NameError: No resource, method, or local variable named `remove_ruby' for `PoiseRuby::RubyBuild::Provider ""' #1

Closed edwardsamuel closed 8 years ago

edwardsamuel commented 8 years ago

When I run this recipes:


...

application '/opt/test_rails' do
  git '/opt/test_rails' do
    ...
  end

  ruby_runtime '/opt/test_rails' do
    provider :ruby_build
    version '2.2.3'
    action :install
  end

  ruby_gem 'bundler'

  bundle_install do
    deployment true
    without %w{development test}
  end

  rails do
    migrate true
    secret_token 'd78fe08df56c9'
  end

  unicorn do
    port 3000
  end
end

I got NameError: No resource, method, or local variable namedremove_ruby' for PoiseRuby::RubyBuild::Provider ""'.

==> default:   
==> default: * application_ruby[/opt/test_rails] action install
==> default:     
==> default: 
==> default:     
==> default: ================================================================================
==> default:     
==> default: Error executing action `install` on resource 'application_ruby[/opt/test_rails]'
==> default:     
==> default: ================================================================================
==> default:     
==> default: 
==> default:     NameError
==> default:     ---------
==> default:     No resource, method, or local variable named `remove_ruby' for `PoiseRuby::RubyBuild::Provider ""'
==> default:     
==> default:     Cookbook Trace:
==> default:     ---------------
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise-ruby-build/files/halite_gem/poise_ruby/ruby_build/provider.rb:99:in `block (2 levels) in install_ruby'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise/files/halite_gem/poise/helpers/subcontext_block.rb:54:in `instance_eval'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise/files/halite_gem/poise/helpers/subcontext_block.rb:54:in `subcontext_block'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise/files/halite_gem/poise/helpers/notifying_block.rb:67:in `notifying_block'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise-ruby-build/files/halite_gem/poise_ruby/ruby_build/provider.rb:92:in `block in install_ruby'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise-ruby-build/files/halite_gem/poise_ruby/ruby_build/provider.rb:91:in `install_ruby'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise-ruby/files/halite_gem/poise_ruby/ruby_providers/base.rb:44:in `block in action_install'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise/files/halite_gem/poise/helpers/subcontext_block.rb:54:in `instance_eval'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise/files/halite_gem/poise/helpers/subcontext_block.rb:54:in `subcontext_block'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise/files/halite_gem/poise/helpers/notifying_block.rb:67:in `notifying_block'
==> default:     /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/poise-ruby/files/halite_gem/poise_ruby/ruby_providers/base.rb:43:in `action_install'
==> default:     
==> default:     Resource Declaration:
==> default:     ---------------------
==> default:     # In /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/smile-vg/recipes/default.rb
==> default:     
==> default:      62:   ruby_runtime '/opt/test_rails' do
==> default:      63:     provider :ruby_build
==> default:      64:     version '2.2.3'
==> default:      65:     action :install
==> default:      66:   end
==> default:      67: 
==> default:     
==> default:     Compiled Resource:
==> default:     ------------------
==> default:     # Declared in /tmp/vagrant-chef/f3266097f9fa7438d493376a0b10481a/cookbooks/smile-vg/recipes/default.rb:62:in `block in from_file'
==> default:     
==> default:     application_ruby("/opt/test_rails") do
==> default:       provider PoiseRuby::RubyBuild::Provider
==> default:       action [:install]
==> default:       retries 0
==> default:       retry_delay 2
==> default:       default_guard_interpreter :default
==> default:       subresources [ruby_gem[bundler], application_bundle_install[/opt/test_rails], application_rails[/opt/test_rails], application_unicorn[/opt/test_rails]]
==> default:       declared_type :application_ruby
==> default:       cookbook_name :"smile-vg"
==> default:       recipe_name "default"
==> default:       parent application[/opt/test_rails]
==> default:       version "2.2.3"
==> default:       parent_ruby nil
==> default:       parent_bundle nil
==> default:       bundler_version true
==> default:     end
==> default:     
==> default: [2016-02-13T08:18:42+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default: 
==> default: Running handlers:
==> default: [2016-02-13T08:18:42+00:00] ERROR: Running exception handlers
==> default: Running handlers complete
==> default: [2016-02-13T08:18:42+00:00] ERROR: Exception handlers complete
==> default: Chef Client failed. 3 resources updated in 33 seconds
==> default: [2016-02-13T08:18:42+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2016-02-13T08:18:42+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> default: [2016-02-13T08:18:42+00:00] ERROR: application_ruby[/opt/test_rails] (smile-vg::default line 62) had an error: NameError: No resource, method, or local variable named `remove_ruby' for `PoiseRuby::RubyBuild::Provider ""'
==> default: [2016-02-13T08:18:42+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

When I check on this project (poise-ruby-build), I found that remove_ruby is called in https://github.com/poise/poise-ruby-build/blob/v1.0.1/lib/poise_ruby/ruby_build/provider.rb#L99, but there is no remove_ruby method defined.

coderanger commented 8 years ago

Thanks for the report!

ytabira commented 8 years ago

How do you get this commit as a cookbook?

Berksfile is

...
cookbook 'poise-ruby-build', git: 'https://github.com/poise/poise-ruby-build.git', ref: 'a50fc5ac8caa4278138c910d0f24cd6a9c947747'
...

I got this error: The resource at '/var/folders/g7/g_bxwd2s7_53mqjnsmn_crl80000gn/T/d20160225-38460-9fmsa7' does not appear to be a valid cookbook. Does it have a metadata.rb?

$ berks install -d

...

I, [2016-02-25T13:15:07.971960 #38460]  INFO -- : Installing from universe
Fetching 'poise-ruby-build' from https://github.com/poise/poise-ruby-build.git (at a50fc5a)
The resource at '/var/folders/g7/g_bxwd2s7_53mqjnsmn_crl80000gn/T/d20160225-38460-9fmsa7' does not appear to be a valid cookbook. Does it have a metadata.rb?
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/locations/base.rb:59:in `validate_cached!'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/locations/git.rb:67:in `install'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/installer.rb:184:in `block in download_locations'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/installer.rb:181:in `each'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/installer.rb:181:in `download_locations'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/installer.rb:154:in `install_from_universe'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/installer.rb:39:in `run'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/berksfile.rb:374:in `install'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/cli.rb:143:in `install'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/cli.rb:52:in `dispatch'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/lib/berkshelf/cli.rb:27:in `execute!'
    /Users/ytabira/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/berkshelf-4.0.1/bin/berks:5:in `<top (required)>'
    /Users/ytabira/.rbenv/versions/2.2.3/bin/berks:23:in `load'
    /Users/ytabira/.rbenv/versions/2.2.3/bin/berks:23:in `<main>'
coderanger commented 8 years ago

https://github.com/poise/halite#using-a-pre-release-version-of-a-cookbook

ytabira commented 8 years ago

Thank you for your quick reply!

dorongutman commented 8 years ago

Can you please tag a new version with this ? It's very hard to accomplish this pre-release magic with Berkshire and impossible with Librarian.

Thanks.