chef cookbook fails on ohai undefined method `[]' for nil:NilClass

后端 未结 4 709
时光取名叫无心
时光取名叫无心 2021-01-13 11:01

I\'m working on a chef cookbook to set up a vanilla ubuntu 12.04.2 with nginx postgresql and unicorn on my vagrant box, but I\'m getting into troubles with nginx, there\'s a

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 11:51

    You haven't stated which version of the ohai and nginx cookbooks you're using.

    While I can't answer your question I can provide some advice on managing your cookbooks by using a dependency manager (think bundler for cookbooks).

    Install Berkshelf

    gem install berkshelf
    

    Create a Berkshelf file

    $ cat Berksfile
    
    site :opscode
    
    cookbook "nginx"
    

    And use this to download all the cookbooks associated with nginx:

    $ berks install -p cookbooks
    Using nginx (2.0.0)
    Using apt (2.3.0)
    Using bluepill (2.3.0)
    Using rsyslog (1.9.0)
    Using build-essential (1.4.2)
    Using ohai (1.1.12)
    Using runit (1.2.0)
    Using yum (2.3.2)
    

    The "-p" option places them in the "cookbooks" subdirectory:

    $ ls -d cookbooks/*
    cookbooks/apt       
    cookbooks/build-essential  
    cookbooks/ohai     
    cookbooks/runit
    cookbooks/bluepill  
    cookbooks/nginx            
    cookbooks/rsyslog  
    cookbooks/yum
    

提交回复
热议问题