简体   繁体   English

OpsWorks Chef:由于旧的Ruby(1.8.7),无法编译yum食谱

[英]OpsWorks Chef: Cannot compile yum cookbook due to old Ruby (1.8.7)

I know in OpsWorks, Ruby version can be changed using custom Chef JSON like one in this topic . 我知道在OpsWorks中,可以使用自定义Chef JSON更改Ruby版本,例如本主题中的一个

But the problem is, before the new Ruby is installed, the default one (1.8.7) is used to compiled cookbooks. 但是问题是,在安装新的Ruby之前,将默认的(1.8.7)用于编译菜谱。 And Ruby version 1.8.7 cannot understand this code style ( see here ): Ruby版本1.8.7无法理解此代码样式( 请参见此处 ):

name: 'value',

I think it only accepts this style: 我认为它只接受这种风格:

:name => "value",

Any suggestion to solve this? 有什么解决的建议吗?

Thank you. 谢谢。

UPDATE #1: 更新#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. 临时的解决方法:我签出了yum cookbook的旧版本 ,其中的代码对于旧Ruby仍然有效。

UPDATE #2: 更新#2:

If I could use Chef-embedded Ruby then problem will be solved. 如果我可以使用Chef嵌入的Ruby,那么问题将得到解决。 Could anyone show how to use that embedded Ruby version? 谁能展示如何使用该嵌入式Ruby版本? Thank you. 谢谢。

I think the ruby version sethvargo references above is not the one that AWS uses for the Chef run. 我认为上面提到的ruby版本sethvargo并非AWS用于Chef运行的版本。 That is the ruby version that will be used for the Rails layer. 那是将用于Rails层的红宝石版本。 According to this issue https://github.com/aws/opsworks-cookbooks/issues/50 AWS is apparently running Chef11 on Ruby 1.8.7 根据此问题https://github.com/aws/opsworks-cookbooks/issues/50 AWS显然在Ruby 1.8.7上运行Chef11

根据Amazon OpsWorks文档 ,您可以指定版本,OpsWorks将使用:

node.set['ruby']['full_version'] = '1.9.3'

OpsWorks现在支持Chef 11.10,Ruby 2.0,berkshelf,数据包和搜索-这应该可以解决您的问题http://aws.typepad.com/aws/2014/03/aws-opsworks-now-supports-chef-1110。 HTML

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM