Puppet install gem失败但无论如何都安装了gem

时间:2013-07-19 22:09:47

标签: zurb-foundation puppet

我有一个安装Zurb Foundation gem的Puppet清单:

class compass {
    package { ["rubygems"]:
        ensure => 'installed'
    }
    package { ['zurb-foundation']:
        ensure => '3.0.6',
        provider => 'gem',
        require => Package['rubygems']
    }
}

运行puppet apply时会出现以下错误:

err: /Stage[main]/Compass/Package[zurb-foundation]/ensure: change from absent to 3.0.6 failed: Could not update: Execution of '/usr/bin/gem install -v 3.0.6 --include-dependencies --no-rdoc --no-ri zurb-foundation' returned 1: INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Building native extensions.  This could take a while...
ERROR:  Error installing zurb-foundation:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:4:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.0/ext/ffi_c/gem_make.out
 at /etc/puppet/manifests/classes/compass.pp:25

但是,执行gem list会产生以下结果:

# gem list

*** LOCAL GEMS ***

chunky_png (1.2.8)
compass (0.12.2)
fssm (0.2.10)
rake (10.1.0)
rb-fsevent (0.9.3)
sass (3.2.0.alpha.277)
zurb-foundation (3.0.6)

该错误导致puppet apply无法正常完成,因为由于依赖性失败而导致大量项目被跳过。我该怎么办?

1 个答案:

答案 0 :(得分:3)

我认为问题在于你没有为ruby安装ruby开发工具包(这就是用于构建原生扩展的东西)。

你想要添加类似的东西(根据你的红宝石版本可能会有所不同):

package { 'ruby-dev':
  ensure => installed,
  before => Package['zurb-foundation'],
}

这应该允许宝石正确构建,让你的木偶也完成。