簡體   English   中英

使用Chef在Vagrant VM上安裝Postgres的問題:Config:Module的未定義方法“ ruby​​”

[英]Issue with installing Postgres on Vagrant VM using Chef: undefined method `ruby' for Config:Module

這就是我的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盒子。 而且,當我的VM在vagrant up啟動vagrant up ,我得到了很長的回溯,並顯示錯誤消息:Config:Module`的undefined method ruby'。

有人遇到過嗎?

安裝“ 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

從那以后,我發現有一個紅寶石配方也可以解決此問題(通過設置構建基本節點屬性來解決)。 將其添加到運行列表或使用數據庫食譜

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM