2

I know in OpsWorks, Ruby version can be changed using custom Chef JSON like one in this topic.

But the problem is, before the new Ruby is installed, the default one (1.8.7) is used to compiled cookbooks. And Ruby version 1.8.7 cannot understand this code style (see here):

name: 'value',

I think it only accepts this style:

:name => "value",

Any suggestion to solve this?

Thank you.

UPDATE #1:

A temporary workaround for this: I checked out an older version of the yum cookbook, where the code is still valid for old Ruby.

UPDATE #2:

If I could use Chef-embedded Ruby then problem will be solved. Could anyone show how to use that embedded Ruby version? Thank you.

Community
  • 1
  • 1
Tung Nguyen
  • 1,874
  • 3
  • 18
  • 28
  • Chef 11 not comes with it's own embedded of Ruby (1.9.2). I don't use opsworks, but seems to be a bad idea to run chef on such an old version of Ruby. – Mark O'Connor Nov 11 '13 at 20:47
  • The embedded install lives in /opt/chef/embedded/bin/ruby as an FYI – Display Name is missing Nov 12 '13 at 00:24
  • @MarkO'Connor, I do not opt yo use that old version of Ruby, I am "forced" to. Do you have any suggestion? And better_use_mkstemp, I looked at the path and there was not such an directory :) – Tung Nguyen Nov 12 '13 at 08:00
  • I find it hard to believe that opsworks uses such an old version of Ruby. As stated Chef comes with an embedded copy of Ruby so there is really no good reason not to use that. However, if you're correct, then you'll discover lots of chef recipes which will not work as expected. – Mark O'Connor Nov 12 '13 at 22:05
  • Yes, their default OS is Ubuntu 12.04 LTS, which has Ruby 1.8.7 by default. I saw Opscode's **yum** cookbook has been changed and is no longer compatible with old Ruby, you can read Q&A [here](https://github.com/opscode-cookbooks/yum/commit/f9e182ee68b7935e5a3de72f1abd078c0d747545#commitcomment-4561513). Anyway, if I could use embedded Ruby then problem will be solved. Could you show me how to use Chef-embedded Ruby? Thanks. – Tung Nguyen Nov 13 '13 at 03:25

3 Answers3

1

I think the ruby version sethvargo references above is not the one that AWS uses for the Chef run. That is the ruby version that will be used for the Rails layer. According to this issue https://github.com/aws/opsworks-cookbooks/issues/50 AWS is apparently running Chef11 on Ruby 1.8.7

donden1
  • 1,535
  • 1
  • 10
  • 3
0

According to the Amazon OpsWorks documentation, you can specify the version and OpsWorks will use:

node.set['ruby']['full_version'] = '1.9.3'
sethvargo
  • 26,739
  • 10
  • 86
  • 156
0

OpsWorks now supports Chef 11.10, Ruby 2.0, berkshelf, data bags, and search - this should solve your issue http://aws.typepad.com/aws/2014/03/aws-opsworks-now-supports-chef-1110.html

T M
  • 26