如何使用厨师在vagrant centos box上设置omnibus builder环境?

时间:2016-03-08 13:39:08

标签: centos vagrant chef chef-solo

我需要一个用于构建python cli包的omnibus构建器框。

我想在this cookbook

上使用this vagrantbox

我以root身份运行它,因为omnibus安装程序需要使用/ opt

中的数据来检查某些内容

我的vagrantfile看起来像这样:

# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
  config.vm.box = "centos65opscode"
  # config.vm.provision "chef_solo" do |chef|
  #   chef.add_recipe "omnibus"
  # end
  config.librarian_chef.cheffile_dir = "chef"
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "chef/cookbooks"
    chef.add_recipe "omnibus"
  end
end

由于流浪汉的图书馆员厨师插件似乎没有做任何事情,我手动添加了所有依赖项:

我收到此错误:

==> default: NameError
==> default: ---------
==> default: uninitialized constant Chef::Sugar::DSL
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default:   /tmp/vagrant-chef/745d120a7b8f9ecb5d8e9f185062c794/cookbooks/languages/libraries/_helper.rb:31:in `<module:Helper>'
==> default:   /tmp/vagrant-chef/745d120a7b8f9ecb5d8e9f185062c794/cookbooks/languages/libraries/_helper.rb:30:in `<module:Languages>'
==> default:   /tmp/vagrant-chef/745d120a7b8f9ecb5d8e9f185062c794/cookbooks/languages/libraries/_helper.rb:29:in `<top (required)>'
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef/745d120a7b8f9ecb5d8e9f185062c794/cookbooks/languages/libraries/_helper.rb:
==> default:
==> default:  24:  rescue LoadError
==> default:  25:    Chef::Log.warn 'chef-sugar gem could not be loaded.'
==> default:  26:  end
==> default:  27:
==> default:  28:  # Various code vendored from omnibus cookbook
==> default:  29:  module Languages
==> default:  30:    module Helper
==> default:  31>>     include Chef::Sugar::DSL if Chef.const_defined?('Sugar')
==> default:  32:
==> default:  33:      #
==> default:  34:      # Performs a `File.join` but ensures all forward slashes are replaced
==> default:  35:      # by backward slashes.
==> default:  36:      #
==> default:  37:      # @return [String]
==> default:  38:      #
==> default:  39:      def windows_safe_path_join(*args)
==> default:  40:        ::File.join(args).gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用vagrant chef provisioning

Vagrant.configure("2") do |config|
  config.vm.provision "chef_solo" do |chef|
    chef.add_recipe "omnibus"
  end
end

并将github omnibus项目添加到cookbooks目录中,如

.
|-- Vagrantfile
|-- cookbooks
|   |-- omnibus
|       |-- recipes
|           |-- default.rb
|       |-- ...