0

我有一个安装 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

但是,执行 agem 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无法正确完成,因为由于依赖关系失败而跳过了许多项目。我能做些什么?

4

1 回答 1

3

我认为问题在于您没有为您的 ruby​​ 安装 ruby​​ 开发工具包(这就是用于构建本机扩展的工具)。

您需要添加类似的内容(根据您的 ruby​​ 版本可能会有所不同):

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

这应该允许 gem 正确构建并让您的 puppet 运行也完成。

于 2013-07-20T00:53:26.937 回答