Last active
December 20, 2015 04:59
-
-
Save maraca/6075307 to your computer and use it in GitHub Desktop.
ChefSpec cannot load such file -- rvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadError | |
--------- | |
cannot load such file -- rvm | |
Cookbook Trace: | |
--------------- | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb:25:in `require' | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file' | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file' | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file' | |
/home/martin/application-cookbook/vendor/cookbooks/application/recipes/app.rb:2:in `from_file' | |
/home/martin/application-cookbook/spec/app_spec.rb:14:in `block (2 levels) in <top (required)>' | |
/home/martin/application-cookbook/spec/app_spec.rb:22:in `block (2 levels) in <top (required)>' | |
Relevant File Content: | |
---------------------- | |
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb: | |
18: # | |
19: | |
20: # install rvm api gem during chef compile phase | |
21: chef_gem 'rvm' do | |
22: action :install | |
23: version '>= 1.11.3.6' | |
24: end | |
25>> require 'rvm' | |
26: | |
27: create_rvm_shell_chef_wrapper | |
28: create_rvm_chef_user_environment | |
29: | |
30: class Chef::Resource | |
31: # mix in #rvm_cmd_wrap helper into resources | |
32: include Chef::RVM::ShellHelpers | |
33: end | |
34: | |
F | |
Failures: | |
1) application::app includes the chef-rvm system-wide recipe | |
Failure/Error: runner.converge 'application::app' | |
LoadError: | |
cannot load such file -- rvm | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `require' | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file' | |
# ./vendor/cookbooks/application/recipes/app.rb:2:in `from_file' | |
# ./spec/app_spec.rb:14:in `block (2 levels) in <top (required)>' | |
# ./spec/app_spec.rb:18:in `block (2 levels) in <top (required)>' | |
2) application::app creates a /app/prod/ directory | |
Failure/Error: runner.converge 'application::app' | |
LoadError: | |
cannot load such file -- rvm | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `require' | |
# ./vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file' | |
# ./vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file' | |
# ./vendor/cookbooks/application/recipes/app.rb:2:in `from_file' | |
# ./spec/app_spec.rb:14:in `block (2 levels) in <top (required)>' | |
# ./spec/app_spec.rb:22:in `block (2 levels) in <top (required)>' | |
Finished in 0.34893 seconds | |
2 examples, 2 failures | |
Failed examples: | |
rspec ./spec/app_spec.rb:17 # application::app includes the chef-rvm system-wide recipe | |
rspec ./spec/app_spec.rb:21 # application::app creates a /app/prod/ directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_recipe "rvm::system" | |
directory "app" do | |
owner node['proxy']['user'] | |
group node['proxy']['group'] | |
path node['app']['path'] | |
recursive true | |
action :create | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require "chefspec" | |
describe 'application::app' do | |
let(:app_path) { '/app/prod' } | |
let(:cpu) { 1 } | |
let(:chef_run) { | |
runner = ChefSpec::ChefRunner.new(:platform => 'ubuntu', :version => '12.04') | |
runner.node.set['cpu']['total'] = cpu | |
runner.node.set['app']['path'] = app_path | |
runner.converge 'application::app' | |
} | |
it 'includes the chef-rvm system-wide recipe' do | |
expect(chef_run).to include_recipe 'rvm::system' | |
end | |
it 'creates a /app/prod/ directory' do | |
expect(chef_run).to create_directory app_path | |
end | |
end |
I've encountered the same problem in a different way:
chef_gem 'netaddr'
require 'netaddr'
service 'network' do
action :enable
end
node['network']['devices'].each_pair do |device, configuration|
cidr = {}
cidr[:ipv4] = ::NetAddr::CIDR.create(configuration['ipv4']['cidr'])
if configuration.has_key? 'ipv6'
cidr[:ipv6] = ::NetAddr::CIDR.create(configuration['ipv6']['cidr'])
end
template "/etc/sysconfig/network-scripts/ifcfg-#{device}" do
source 'physical.erb'
variables device: device,
configuration: configuration,
cidr: cidr
notifies :restart, 'service[network]'
end
end
This fails:
7: chef_gem 'netaddr'
8>> require 'netaddr'
9:
10: service 'network' do
11: action :enable
12: end
13:
14: node['network']['devices'].each_pair do |device, configuration|
15: cidr = {}
16: cidr[:ipv4] = ::NetAddr::CIDR.create(configuration['ipv4']['cidr'])
17:
F
Failures:
1) network::default installs prerequisites
Failure/Error: end.converge(described_recipe) }
LoadError:
cannot load such file -- netaddr
# ./recipes/default.rb:8:in `require'
# ./recipes/default.rb:8:in `from_file'
# ./spec/recipes/default_spec.rb:34:in `block (2 levels) in <top (required)>'
# ./spec/recipes/default_spec.rb:37:in `block (2 levels) in <top (required)>'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also get this error. Were you able to get this working?