Syntax error on a Chef official recipe, provisioning Vagrant - vagrant

I'm having a syntax error on an official recipe. When I tried to run this recipe from inside a vagrant box, it worked fine. I used:
chef-client --local-mode --runlist [...]
Now I'm trying to provision the box with chef-solo, as chef-client requires a server and keys. It should be equivalent.
This is my Vagrantfile, where I have two machines, each provisioned by some chef recipes. I also set ssh to X mode, DNS redirection for name resolving, the memory assigned to each machine, and the shared folder.
The error appears if I add to the runlist recipe1, recipe2, or even without any recipy in runlist.
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise64"
# Needs vagrant 1.7.2 or newer
# chef.install = true
# chef.version = "latest"
# ---- BEGIN MOST RELEVANT PART ----
config.vm.define "mybox" do |a|
a.vm.network "private_network", ip: "192.168.33.12"
config.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = "myproject-cookbook/cookbooks"
#chef.add_recipe "myproject::recipe1"
#chef.add_recipe "myproject::recipe2"
#chef.add_recipe "myproject::recipe3"
end
end
# ---- END MOST RELEVANT PART ----
config.vm.define "myotherbox" do |c|
c.vm.network "private_network", ip: "192.168.33.11"
config.vm.provision "chef_solo" do |chef|
chef.cookbooks_path = "myproject-cookbook/cookbooks"
chef.add_recipe "myproject::recipe4"
end
end
config.ssh.forward_x11 = true
config.vm.provider :virtualbox do |vb|
# DNS queries to the host, which becomes a DNS Proxy
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
# Lease more RAM to the guest
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.synced_folder "../shared", "/home/vagrant/public"
end
The actual error comes from an official cookbook, windows, which I don't know why chef runs it if I haven't specified a single recipe to run.
$ vagrant provision
==> mybox: Running provisioner: chef_solo...
Generating chef JSON and uploading...
==> mybox: Warning: Chef run list is empty. This may not be what you want.
==> mybox: Running chef-solo...
==> mybox: stdin: is not a tty
==> mybox: [2015-03-04T11:08:09+00:00] INFO: *** Chef 10.14.2 ***
==> mybox: [2015-03-04T11:08:11+00:00] INFO: Run List is []
==> mybox: [2015-03-04T11:08:11+00:00] INFO: Run List expands to []
==> mybox: [2015-03-04T11:08:11+00:00] INFO: Starting Chef Run for precise64
==> mybox: [2015-03-04T11:08:11+00:00] INFO: Running start handlers
==> mybox: [2015-03-04T11:08:11+00:00] INFO: Start handlers complete.
==> mybox:
==> mybox: ================================================================================
==> mybox: Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/windows/libraries/windows_package.rb
==> mybox: ================================================================================
==> mybox:
==> mybox: SyntaxError
==> mybox: -----------
==> mybox: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/windows/libraries/windows_package.rb:239: syntax error, unexpected ':', expecting kEND
==> mybox: provides :windows_package, os: "windows"
==> mybox: ^
==> mybox: Cookbook Trace:
==> mybox: ---------------
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:140:in `load'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:140:in `load_libraries'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:230:in `call'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:230:in `foreach_cookbook_load_segment'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:229:in `each'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:229:in `foreach_cookbook_load_segment'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:227:in `each'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:227:in `foreach_cookbook_load_segment'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:137:in `load_libraries'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:62:in `load'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/client.rb:198:in `setup_run_context'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/client.rb:418:in `do_run'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/client.rb:176:in `run'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application/solo.rb:230:in `run_application'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application/solo.rb:218:in `loop'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application/solo.rb:218:in `run_application'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application.rb:70:in `run'
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/chef-solo:25
==> mybox: /opt/vagrant_ruby/bin/chef-solo:19:in `load'
==> mybox: /opt/vagrant_ruby/bin/chef-solo:19
==> mybox:
==> mybox: Relevant File Content:
==> mybox: ----------------------
==> mybox: /opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/run_context.rb:
==> mybox:
==> mybox: 1: #
==> mybox: 2: # Author:: Adam Jacob (<adam#opscode.com>)
==> mybox: 3: # Author:: Christopher Walters (<cw#opscode.com>)
==> mybox: 4: # Author:: Tim Hinderliter (<tim#opscode.com>)
==> mybox: 5: # Copyright:: Copyright (c) 2008-2010 Opscode, Inc.
==> mybox: 6: # License:: Apache License, Version 2.0
==> mybox: 7: #
==> mybox: 8: # Licensed under the Apache License, Version 2.0 (the "License");
==> mybox: 9: # you may not use this file except in compliance with the License.
==> mybox:
==> mybox: [2015-03-04T11:08:11+00:00] ERROR: Running exception handlers
==> mybox: [2015-03-04T11:08:11+00:00] ERROR: Exception handlers complete
==> mybox: [2015-03-04T11:08:11+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> mybox: [2015-03-04T11:08:11+00:00] FATAL: SyntaxError: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/windows/libraries/windows_package.rb:239: syntax error, unexpected ':', expecting kEND
==> mybox: provides :windows_package, os: "windows"
==> mybox: ^
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
It's relevant to say that I haven't edited this recipe, that it works fine with chef-client executing it manually instead of from vagrant, and most important, that the exact version of ruby that should be executing the recipe says there is no syntax:
$ /opt/chef/embedded/bin/ruby -c myproject-cookbook/cookbooks/windows/libraries/windows_package.rb
Syntax OK
You can check the recipe failing in github
The cookbooks in the cookbooks folder are:
7-zip
ark
chef_handler
java
maven
myproject
windows
Actual questions:
Why is this "windows_package" recipe run?
Why chef complains about a Syntax error and ruby by itself doesn't?
EDIT (I have a hardly any privilege):
Yes, chef is strangely at version 10.14.2 in guest "mybox":
vagrant#precise64:~$ chef-solo -v
Chef: 10.14.2
Instead, chef-client in host is at the version installed by the omnibus installer...
user#host$ chef-solo -v
Chef: 12.1.0
I thought that host's chef was replicated to the guest and then run inside guest, I will recheck provisioning and try to make it install the proper version.
Thanks!
EDIT2:
It was actually the chef version. It looks like no chef needs to be installed on the host beforehand; instead, vagrant installs it by itself on guest, choosing the version it likes.
Until vagrant version 1.7.2 one needed to install vagrant-omnibus plugin in order to choose the version to install. See how to do it.
Starting from 1.7.2, one can do it without the need of any plugin, using "install" and "version" methods. The doc here.
Source: Mazinlabs blog (in japanese)

I'm pretty sure this has to do with the chef version installed on the box:
==> mybox: [2015-03-04T11:08:09+00:00] INFO: *** Chef 10.14.2 ***
I can't be sure but I bet you're using a different chef version when trying from ssh. Anyway 10.14.2 is pretty old and you'll hit errors with recent cookbooks.
IIRC there's a vagrant plugin to install/upadte chef (vagrant-omnibus ?)

Related

Chef-zero provision: unlocated cookbook

I'm getting this message:
==> default: ================================================================================
==> default: Recipe Compile Error
==> default: ================================================================================
==> default:
==> default: Chef::Exceptions::RecipeNotFound
==> default: --------------------------------
==> default: could not find recipe default for cookbook olingo
==> default: System Info:
==> default: ------------
==> default: chef_version=13.6.4
==> default: platform=centos
==> default: platform_version=7.4.1708
==> default: ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
==> default: program_name=chef-client worker: ppid=4729;start=20:31:47;
==> default: executable=/opt/chef/bin/chef-client
As you can see, chef is not able to find olingo cookbook.
My vagrant chef-zero provision section is:
config.vm.provision "chef_zero" do |chef|
chef.cookbooks_path = "berks-cookbooks"
chef.data_bags_path = "data_bags"
chef.nodes_path = "nodes"
chef.roles_path = "roles"
chef.add_recipe "olingo" <<<<1>>>>
end
As you can see at <<<<1>>>>, I've specified that chef installs olingo cookbook. As you can see, I'm using chef-zero as well.
In order to download all cookbook dependencies, I'm using berkshelf tool. So I've created a Berksfile:
source 'https://supermarket.chef.io'
metadata
and metadata.rb:
name 'olingo' <<<2>>>
maintainer 'The Authors'
maintainer_email 'you#example.com'
license 'all_rights'
description 'Installs/Configures webapi'
long_description 'Installs/Configures webapi'
version '0.1.0'
depends 'java_se', '~> 8.141.0'
depends 'wildfly', '~> 0.4.0'
So, then I perform berks vendor and a berks-cookbooks folder is created filled with all olingo dependencies, but no olingo cookbook is located there.
So, it seems olingo cookbook is not available when chef_client tries to install olingo cookbook.
Any ideas?

Chef solo with berkshelf: cookbook not resolved

I've created this Vagrantfile's provioner section:
config.vm.provision "chef_solo" do |chef|
chef.add_recipe "wildfly"
end
I'm getting this error:
==> default: Error Resolving Cookbooks for Run List:
==> default:
==> default: Missing Cookbooks:
==> default: ------------------
==> default: No such cookbook: wildfly
So, I've created a Berksfile and a metadata.rb files:
Berksfile:
source 'https://supermarket.chef.io'
metadata
metadata.rb:
name 'webapi'
maintainer 'The Authors'
maintainer_email 'you#example.com'
license 'all_rights'
description 'Installs/Configures webapi'
long_description 'Installs/Configures webapi'
version '0.1.0'
depends 'java_se', '~> 9.0.1'
depends 'wildfly', '~> 0.4.0'
So, then I've performed berks install command. The first issue I've detected is that I don't quite detect where berks has placed cookbooks. It seems that it works right, nevertheless, I don't find where cookbooks dependencies are located, I mean, a .\cookbooks folder is not created after performing berks install command.
Resolving cookbook dependencies...
Fetching 'olingo' from source at .
Fetching cookbook index from https://supermarket.chef.io...
Using apt (6.1.4)
Using homebrew (4.2.0)
Using java (1.50.0)
Using java_se (9.0.1)
Using ohai (5.2.0)
Using olingo (0.1.0) from source at .
Using wildfly (0.4.0)
Using yum (5.1.0)
Using windows (3.4.0)
Regardless of that, I've performed vagrant provision again, and wildfly cookbook is not resolved:
The cookbook path 'D:/projects/swiller/querydsl/olingo/infrastructure/cookbooks' doesn't exist. Ignoring...
Running provisioner: chef_solo...
==> default: Error Resolving Cookbooks for Run List:
==> default:
==> default: Missing Cookbooks:
==> default: ------------------
==> default: No such cookbook: wildfly
You either need to use the vagrant-berkshelf plugin, or use the berks vendor command to write all the cookbooks to a folder and then point Vagrant at that (which is what the plugin does internally). berks install only downloads them to your workstation, it doesn't put the cookbooks in a place/format that anything other than Berkshelf understands.

Chef Client failed. 0 resources updated in 01 seconds - ERROR: wrong number of arguments (given 1, expected 3)

I am trying to run a simple Hazelcast cluster on Amazon EC2 following the official code sample, every step seems to be OK but when running vagrant up --provider=aws ( under the header "Let's do this thing" ) it fails as shown:
==> hazelcast2: - ohai (5.2.0)
==> hazelcast2: Installing Cookbook Gems:
==> hazelcast2: Compiling Cookbooks...
==> hazelcast2: [2017-10-24T20:03:06+00:00] INFO: The plugin path /etc/chef/ohai/plugins does not exist. Skipping...
==> hazelcast2: [2017-10-24T20:03:06+00:00] WARN:
[DEPRECATION] Plugin at /tmp/vagrant-chef/ohai/cookbook_plugins/ohai/hint.rb is a version 6 plugin.
Version 6 plugins will not be supported in Chef/Ohai 14. Please upgrade your plugin to version 7 plugin format.
For more information visit here: docs.chef.io/ohai_custom.html
==> hazelcast2:
==> hazelcast2: Running handlers:
==> hazelcast2: [2017-10-24T20:03:06+00:00] ERROR: Running exception handlers
==> hazelcast2: Running handlers complete
==> hazelcast2:
==> hazelcast2: [2017-10-24T20:03:06+00:00] ERROR: Exception handlers complete
==> hazelcast2: Chef Client failed. 0 resources updated in 01 seconds
==> hazelcast2: [2017-10-24T20:03:06+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> hazelcast2: [2017-10-24T20:03:06+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
==> hazelcast2: [2017-10-24T20:03:06+00:00] ERROR: wrong number of arguments (given 1, expected 3)
==> hazelcast2: [2017-10-24T20:03:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully
(exit code 1)
==> hazelcast2: An error occurred. The error will be shown after all tasks complete.
An error occurred while executing multiple actions in parallel.
Any errors that occurred are shown below.
An error occurred while executing the action on the 'hazelcast1' machine.
Please handle this error then try again:
Chef never successfully completed! Any errors should be visible in the output above.
Please fix your recipes so that they properly complete.
An error occurred while executing the action on the 'hazelcast2' machine.
Please handle this error then try again:
Chef never successfully completed! Any errors should be visible in the output above.
Please fix your recipes so that they properly complete.
/var/chef/cache/chef-stacktrace.out:
Generated at 2017-10-24 21:36:55 +0000
ArgumentError: wrong number of arguments (given 1, expected 3)
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/dsl/plugin/versionvi.rb:27:in `initialize'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in `new'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in `load_v7_plugin'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:93:in `block in load_additional'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:90:in `collect'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:90:in `load_additional'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/system.rb:116:in `run_additional_plugins'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/run_context/cookbook_compiler.rb:119:in `compile_ohai_plugins'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/run_context/cookbook_compiler.rb:73:in `compile'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/run_context.rb:192:in `load'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/policy_builder/expand_node_object.rb:97:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/client.rb:513:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/client.rb:281:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:291:in `block in fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:279:in `fork'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:279:in `fork_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:244:in `block in run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/local_mode.rb:44:in `with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:232:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:469:in `sleep_then_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:458:in `block in interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:457:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:457:in `interval_run_chef_client'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/client.rb:441:in `run_application'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application.rb:59:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/lib/chef/application/solo.rb:225:in `run'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.5.3/bin/chef-solo:25:in `<top (required)>'
/usr/bin/chef-solo:58:in `load'
/usr/bin/chef-solo:58:in `<main>'
Ohai version:
ohai -version
Ohai: 13.5.0
Java jdk not installed (when it should be according to the receipt):
java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>
Following the Stacktrace I got to the point where I believe it has something to do with the fact that the function:
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/dsl/plugin/versionvi.rb:27:in `initialize':
def initialize(controller, plugin_path, plugin_dir_path)
super(controller.data)
#controller = controller
#version = :version6
#source = plugin_path
#plugin_dir_path = plugin_dir_path
end
... requires 3 parameters and is called with only one in:
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in 'new' in the function:
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.5.0/lib/ohai/loader.rb:223:in `load_v7_plugin'
def load_v7_plugin(plugin_class)
plugin = plugin_class.new(#controller.data)
collect_provides(plugin)
plugin
end
I repeated the steps on an Ubuntu 14.04 and on an Ubuntu 16.04 VM and I am still stuck with the same Error, any idea what I am doing wrong?
P.S. I am just following the steps in the sample.
Thank you
The important bit is probably this:
[DEPRECATION] Plugin at /tmp/vagrant-chef/ohai/cookbook_plugins/ohai/hint.rb is a version 6 plugin.
Version 6 plugins will not be supported in Chef/Ohai 14. Please upgrade your plugin to version 7 plugin format.
For more information visit here: docs.chef.io/ohai_custom.html
Figure out what is installing that plugin and check if anything is in the same folder and is an invalid plugin.

Why can't I install a vagrant environment with chef? certificate verify failed (OpenSSL::SSL::SSLError)

My environment:
OS: Mac 10.10.1
rbenv: rbenv 0.4.0-129-g7e0e85b
Ruby: ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
My Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use Ubuntu 14.04 Trusty Tahr 64-bit as our operating system
config.vm.box = "precise32"
# Configurate the virtual machine to use 2GB of RAM
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
# Forward the Rails server default port to the host
config.vm.network :forwarded_port, guest: 3000, host: 3000
# Use Chef Solo to provision our virtual machine
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks", "site-cookbooks"]
chef.add_recipe "apt"
chef.add_recipe "nodejs"
chef.add_recipe "ruby_build"
chef.add_recipe "rbenv::user"
chef.add_recipe "rbenv::vagrant"
chef.add_recipe "vim"
chef.add_recipe "mysql::server"
chef.add_recipe "mysql::client"
# Install Ruby 2.1.2 and Bundler
# Set an empty root password for MySQL to make things simple
chef.json = {
rbenv: {
user_installs: [{
user: 'vagrant',
rubies: ["2.1.2"],
global: "2.1.2",
gems: {
"2.1.2" => [
{ name: "bundler" }
]
}
}]
},
mysql: {
server_root_password: ''
}
}
end
end
My Cheffile:
site "http://community.opscode.com/api/v1"
cookbook 'apt'
cookbook 'build-essential'
cookbook 'mysql'
cookbook 'ruby_build'
cookbook 'nodejs', git: 'https://github.com/mdxp/nodejs-cookbook'
cookbook 'rbenv', git: 'https://github.com/fnichol/chef-rbenv'
cookbook 'vim'
After I run vagrant up, I got these errors:
➜ MY_RAILS_PROJECT vagrant up
/Applications/Vagrant/embedded/gems/gems/vagrant-1.3.5/lib/vagrant/util/which.rb:32: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Installing Chef cookbooks with Librarian-Chef...
[default] Destroying VM and associated drives...
[default] Running cleanup tasks for 'chef_solo' provisioner...
/Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:800:in `connect'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/net/http.rb:745:in `start'
from /Users/jingqiangzhang/.vagrant.d/gems/gems/librarian-chef-0.0.4/lib/librarian/chef/source/site.rb:353:in `block in http_get'
I have found this article:
http://railsapps.github.io/openssl-certificate-verify-failed.html
I can confirm my openssl version:
➜ MY_RAILS_PROJECT openssl version
OpenSSL 1.0.1j 15 Oct 2014
I don't know what's the reason.
Change your site to https://supermarket.chef.io/api/v1. If that still fails, you'll need to update your TLS CA data. I'm not sure how Vagrant deals with this, but you can try using certifi if you have a working Python install:
pip install certifi
export SSL_CERT_FILE="$(python -m certifi)"

Unable to run unicorn app server on a vagrant box

I have a vagrant box on which RVM is already installed with ruby 2.0.0-p247. I have packaged the vagrant box and using that box as a base box.
Now I am trying to git clone a github private repo and start the unicorn app server, chef is errors out,here is the output of the error
==> default: stdin: is not a tty
==> default: /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find chef (>= 0) amongst [bundler-1.7.7, bundler-unload-1.0.2, executable-hooks-1.3.2, gem-wrappers-1.2.7, rubygems-bundler-1.4.4, rvm-1.11.3.9] (Gem::LoadError)
==> default: from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
==> default: from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
==> default: from /usr/bin/chef-solo:22:in `<main>'
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
I am not able to debug the issue. Its ubuntu 14.04 box. Kindly help me out
Use the vagrant-omnibus plugin to install Chef. This will give Chef its own isolated Ruby environment separate from your RVM setup.

Resources