2

这就是我的Vagrantfile样子:

   config.vm.provision :chef_solo do |chef|
     chef.cookbooks_path = "cookbooks"

     chef.json = {
        postgresql: {
            password: {
                postgres: 'password'
            }
        },
        database: {
            create: ['mydb']
        },
        'build-essential' => {
            compiletime: true
        }

     }
     chef.run_list = ['recipe[build-essential]', 'recipe[openssl]', 'recipe[postgresql::server]', 'recipe[database::postgresql]']

   end  

我也用过precise32盒子。当我的虚拟机在之后启动时vagrant up,我得到了很长的回溯,并带有错误消息:undefined methodruby​​' for Config:Module`。

有人遇到过这个吗?

4

1 回答 1

5

安装“pg”gem 似乎有问题:

================================================================================      
Error executing action `install` on resource 'chef_gem[pg]'                          
================================================================================      

Gem::Installer::ExtensionBuildError                                                  
-----------------------------------                                                  
ERROR: Failed to build gem native extension.                                          

        /opt/vagrant_ruby/bin/ruby extconf.rb                                        
checking for pg_config... yes                                                        
Using config values from /usr/bin/pg_config                                          
checking for libpq-fe.h... yes                                                        
checking for libpq/libpq-fs.h... yes                                                  
..
..
checking for st.h... yes                                                              
creating extconf.h                                                                    
creating Makefile                                                                    

make                                                                                  
sh: 1: make: not found                         

我建议阅读build-essentials食谱的文档。它建议设置“compiletime”属性以支持确保构建工具可用于编译 RubyGems 扩展。

更新 1

以下 json 设置对我有用:

chef.json = { 
  "postgresql" => {
    "password" => {
      "postgres" => "password"
    }
  },
  "database" => {
    "create" => ["encased_dev"]
  },
  "build_essential" => {
    "compiletime" => true
  }
}

笔记:

  • 属性是“build_essential”而不是“build-essential”

更新 2

从那以后,我发现有一个ruby​​ 配方也可以解决这个问题(通过设置构建基本节点属性)。将其添加到您的运行列表或使用数据库说明书

于 2013-08-17T12:45:49.950 回答