简体   繁体   中英

How do I set up omnibus builder environment on vagrant centos box using chef?

I need an omnibus builder box for building a python cli package.

I would like to use this cookbook , on this vagrantbox

I am running this as root since the omnibus installer needs to check something using data in /opt

my vagrantfile looks like this:

# -*- 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

Since the Librarian chef plugin for vagrant doesn't seem to be doing anything I added all the dependencies manually:

I am getting this error:

==> 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)

Have you tried to use vagrant chef provisioning

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

and add the github omnibus project in a cookbooks directory like

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM