RVM cookbook

Hey guys,

Hope this email finds you well. I am having a bit of a hard time
implementing the RVM cookbook. Essentially I want to have the following:

\curl -L https://get.rvm.io | bash -s stable --ruby

source ~/.rvm/scripts/rvm

rvm requirements

rvm install ruby 2.1.1

rvm use ruby --default

rvm rubygems current

gem install bundler

With that said, I am using this cookbook -
https://github.com/fnichol/chef-rvm:
"Most likely, this is the typical case. Include recipe[rvm::system] in your
run_list and override the defaults you want changed. See below for more
details."

So I setup my role as follow:

name "rvm"

description "RVM applied to all linux nodes."

run_list(

"recipe[rvm::system]"

)

override_attributes(

'rvm' => {

'rubies' => ['ruby-2.1.1'],

'default_ruby' => 'ruby-2.1.1',

'global_gems' => ['bundler', 'rake']

}

)

When running knife, I get the following:

Recipe Compile Error in /var/chef/cache/cookbooks/rvm/recipes/system.rb

TypeError: can't convert Symbol into Integer


/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:191:in
`'

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:191:in
`block in install_rubies'

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:190:in
`each'

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:190:in
`install_rubies'

/var/chef/cache/cookbooks/rvm/recipes/system.rb:29:in `from_file'

Relevant File Content:


/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:

Any suggestions?

--
Nikhil ShahSystem Administrator
nshah@theorchard.comp. (+1) 212 308-5648

THE ORCHARD Distribution Done Right
23 E 4th St Fl 3, New York, NY 10003

Follow us: The Daily Rind http://www.dailyrindblog.com/ • Facebook
http://www.facebook.com/theorchard • Twitter
http://www.twitter.com/orchtweets • YouTube
http://www.youtube.com/user/theorchard • LinkedIn
http://www.linkedin.com/company/the-orchard

Privileged And Confidential Communication. This electronic transmission,
and any documents attached hereto, (a) are protected by the Electronic
Communications Privacy Act (18 USC §§ 2510-2521), (b) may contain
confidential and/or legally privileged information, and (c) are for the
sole use of the intended recipient named above. If you have received this
electronic message in error, please notify the sender and delete the
electronic message. Any disclosure, copying, distribution, or use of the
contents of the information received in error is strictly prohibited.

global_gems requires an array of hashes defining the gems to be installed.

node['rvm']['global_gems'] = [ { 'name' => 'bundler' }, { 'name' => 'rake', 'version' => '0.9.2' }, { 'name' => 'rubygems-bundler', 'action' => 'remove' } ]

On Wednesday, July 30, 2014 at 10:55 PM, Nikhil Shah wrote:

Hey guys,

Hope this email finds you well. I am having a bit of a hard time implementing the RVM cookbook. Essentially I want to have the following:

\curl -L https://get.rvm.io | bash -s stable --ruby
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby 2.1.1
rvm use ruby --default
rvm rubygems current
gem install bundler

With that said, I am using this cookbook - https://github.com/fnichol/chef-rvm:
"Most likely, this is the typical case. Include recipe[rvm::system] in your run_list and override the defaults you want changed. See below for more details."

So I setup my role as follow:

name "rvm"
description "RVM applied to all linux nodes."
run_list(
"recipe[rvm::system]"
)

override_attributes(
'rvm' => {
'rubies' => ['ruby-2.1.1'],
'default_ruby' => 'ruby-2.1.1',
'global_gems' => ['bundler', 'rake']
}
)

When running knife, I get the following:

Recipe Compile Error in /var/chef/cache/cookbooks/rvm/recipes/system.rb

TypeError: can't convert Symbol into Integer

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:191:in []' /var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:191:in block in install_rubies'
/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:190:in each' /var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:190:in install_rubies'
/var/chef/cache/cookbooks/rvm/recipes/system.rb:29:in `from_file'
Relevant File Content:

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:

Any suggestions?

--
Nikhil Shah • System Administrator
nshah@theorchard.com (mailto:nshah@theorchard.com) • p. (+1) 212 308-5648

THE ORCHARD Distribution Done Right
23 E 4th St Fl 3, New York, NY 10003
www.theorchard.com (http://www.theorchard.com/)

Follow us: The Daily Rind (http://www.dailyrindblog.com/) • Facebook (The Orchard) • Twitter (http://www.twitter.com/orchtweets) • YouTube (http://www.youtube.com/user/theorchard) • LinkedIn (The Orchard | LinkedIn)
Privileged And Confidential Communication. This electronic transmission, and any documents attached hereto, (a) are protected by the Electronic Communications Privacy Act (18 USC §§ 2510-2521), (b) may contain confidential and/or legally privileged information, and (c) are for the sole use of the intended recipient named above. If you have received this electronic message in error, please notify the sender and delete the electronic message. Any disclosure, copying, distribution, or use of the contents of the information received in error is strictly prohibited.

Fixed this:

Turns out each iteration passes an object into the "gem" variable. Once I
set my override attribute to the below, It ran like a charm:

override_attributes({

'rvm' => {

    'rubies' => ['ruby-2.1.1'],

    'default_ruby' => 'ruby-2.1.1',

    'global_gems' => [

     { 'name' => 'bundler'},

     { 'name' => 'rake'}

    ]

}

})

On Wed, Jul 30, 2014 at 10:55 PM, Nikhil Shah nshah@theorchard.com wrote:

Hey guys,

Hope this email finds you well. I am having a bit of a hard time
implementing the RVM cookbook. Essentially I want to have the following:

\curl -L https://get.rvm.io | bash -s stable --ruby

source ~/.rvm/scripts/rvm

rvm requirements

rvm install ruby 2.1.1

rvm use ruby --default

rvm rubygems current

gem install bundler

With that said, I am using this cookbook -
https://github.com/fnichol/chef-rvm:
"Most likely, this is the typical case. Include recipe[rvm::system] in
your run_list and override the defaults you want changed. See below for
more details."

So I setup my role as follow:

name "rvm"

description "RVM applied to all linux nodes."

run_list(

"recipe[rvm::system]"

)

override_attributes(

'rvm' => {

'rubies' => ['ruby-2.1.1'],

'default_ruby' => 'ruby-2.1.1',

'global_gems' => ['bundler', 'rake']

}

)

When running knife, I get the following:

Recipe Compile Error in /var/chef/cache/cookbooks/rvm/recipes/system.rb

TypeError: can't convert Symbol into Integer


/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:191:in
`'

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:191:in
`block in install_rubies'

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:190:in
`each'

/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:190:in
`install_rubies'

/var/chef/cache/cookbooks/rvm/recipes/system.rb:29:in `from_file'

Relevant File Content:


/var/chef/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:

Any suggestions?

--
Nikhil ShahSystem Administrator
nshah@theorchard.comp. (+1) 212 308-5648

THE ORCHARD Distribution Done Right
23 E 4th St Fl 3, New York, NY 10003
www.theorchard.com

Follow us: The Daily Rind http://www.dailyrindblog.com/ • Facebook
http://www.facebook.com/theorchard • Twitter
http://www.twitter.com/orchtweets • YouTube
http://www.youtube.com/user/theorchard • LinkedIn
http://www.linkedin.com/company/the-orchard

Privileged And Confidential Communication. This electronic
transmission, and any documents attached hereto, (a) are protected by the
Electronic Communications Privacy Act (18 USC §§ 2510-2521), (b) may
contain confidential and/or legally privileged information, and (c) are for
the sole use of the intended recipient named above. If you have received
this electronic message in error, please notify the sender and delete the
electronic message. Any disclosure, copying, distribution, or use of the
contents of the information received in error is strictly prohibited.

--
Nikhil ShahSystem Administrator
nshah@theorchard.comp. (+1) 212 308-5648

THE ORCHARD Distribution Done Right
23 E 4th St Fl 3, New York, NY 10003

Follow us: The Daily Rind http://www.dailyrindblog.com/ • Facebook
http://www.facebook.com/theorchard • Twitter
http://www.twitter.com/orchtweets • YouTube
http://www.youtube.com/user/theorchard • LinkedIn
http://www.linkedin.com/company/the-orchard

Privileged And Confidential Communication. This electronic transmission,
and any documents attached hereto, (a) are protected by the Electronic
Communications Privacy Act (18 USC §§ 2510-2521), (b) may contain
confidential and/or legally privileged information, and (c) are for the
sole use of the intended recipient named above. If you have received this
electronic message in error, please notify the sender and delete the
electronic message. Any disclosure, copying, distribution, or use of the
contents of the information received in error is strictly prohibited.