ERROR: Cookbook loaded at path(s) has invalid metadata - ruby

When I'm running:
:$ vagrant provision
or
:$ vagrant up
I have an error:
nisevi#localhost processor (master):$ vagrant provision
Using ssh deploy key of: /home/nisevi/.ssh/id_rsa
==> default: Chef 12.0.3 Omnibus package is already installed.
==> default: Running provisioner: shell...
default: Running: inline script
==> default: W
==> default: :
==> default: Duplicate sources.list entry http://security.ubuntu.com/ubuntu/ trusty-security/multiverse amd64 Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_trusty-security_multiverse_binary-amd64_Packages)
==> default: W
==> default: : Duplicate sources.list entry http://security.ubuntu.com/ubuntu/ trusty-security/multiverse i386 Packages (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_trusty-security_multiverse_binary-i386_Packages)
==> default: W: Duplicate sources.list entry http://archive.ubuntu.com/ubuntu/ trusty/multiverse amd64 Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_multiverse_binary-amd64_Packages)
==> default: W: Duplicate sources.list entry http://archive.ubuntu.com/ubuntu/ trusty/multiverse i386 Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_multiverse_binary-i386_Packages)
==> default: W: Duplicate sources.list entry http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse amd64 Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty-updates_multiverse_binary-amd64_Packages)
==> default: W: Duplicate sources.list entry http://archive.ubuntu.com/ubuntu/ trusty-updates/multiverse i386 Packages (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty-updates_multiverse_binary-i386_Packages)
==> default: W: You may want to run apt-get update to correct these problems
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: [2015-01-07T03:09:42+00:00] INFO: Forking chef instance to converge...
==> default: [2015-01-07T03:09:42+00:00] INFO: *** Chef 12.0.3 ***
==> default: [2015-01-07T03:09:42+00:00] INFO: Chef-client pid: 1224
==> default: [2015-01-07T03:09:50+00:00] INFO: Setting the run_list to ["role[processor]"] from CLI options
==> default: [2015-01-07T03:09:50+00:00] INFO: Run List is [role[processor]]
==> default: [2015-01-07T03:09:50+00:00] INFO: Run List expands to [opsworks_initial_setup, mysql::client, dependencies, opsworks_ganglia::client, deploy::default, ba-processor::setup, ba-processor::deploy, sidekiq::deploy, opsworks_ganglia::configure-client]
==> default: [2015-01-07T03:09:50+00:00] INFO: Starting Chef Run for ubuntu1404-opsworks
==> default: [2015-01-07T03:09:50+00:00] INFO: Running start handlers
==> default: [2015-01-07T03:09:50+00:00] INFO: Start handlers complete.
==> default: [2015-01-07T03:09:51+00:00] WARN: found a directory vendor in the cookbook path, but it contains no cookbook files. skipping.
==> default: [2015-01-07T03:09:51+00:00] ERROR: Running exception handlers
==> default: [2015-01-07T03:09:51+00:00] ERROR: Exception handlers complete
==> default: [2015-01-07T03:09:51+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-01-07T03:09:51+00:00] ERROR: Cookbook loaded at path(s) [/tmp/vagrant-chef-3/chef-solo-2/cookbooks/tad-server] has invalid metadata: The `name' attribute is required in cookbook metadata
==> default: [2015-01-07T03:09:51+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Does anyone know what is causing this error or to what is related?

As the error mentions, you must add name 'tad-server' the metadata.rb file in this cookbook. In days long past, this was optional so many people didn't put a metadata.rb in their cookbooks at all, but some tools now require this at a minimum. All other fields in the metadata remain optional, though version is highly recommended.

You need to add your cookbook name to the metadata.rb file inside the cookbook directory.
I just ran into this with the chef-client cookbook. Upload failed till I added the following line to chef-client/metadata.rb
name "chef-client"

Related

How to fix "Could not retrieve mirrorlist" error in vagrant?

When ever I run vagrant up, I am getting the following error.
==> default: [2019-05-30T13:09:31+00:00] INFO: Running queued delayed notifications before re-raising exception
==> default:
==> default: ================================================================================
==> default: Error executing action `create` on resource 'yum_repository[ius]'
==> default: ================================================================================
==> default:
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: execute[yum-makecache-ius] (/tmp/vagrant-chef/bb6e5277837de973166d09e85978af4a/cookbooks/yum/providers/repository.rb line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of yum -q makecache --disablerepo=* --enablerepo=ius ----
==> default: STDOUT: Could not retrieve mirrorlist http://mirrors.iuscommunity.org/mirrorlist/?repo=ius-el6&arch=x86_64&protocol=https error was
==> default: 14: problem making ssl connection
==> default: STDERR: Error: Cannot find a valid baseurl for repo: ius
==> default: ---- End output of yum -q makecache --disablerepo=* --enablerepo=ius ----
==> default: Ran yum -q makecache --disablerepo=* --enablerepo=ius returned 1
==> default:
Seems like something wrong with this URL:
http://mirrors.iuscommunity.org/mirrorlist/?repo=ius-el6&arch=x86_64&protocol=https
I tried with https and http. Even tried disabling sslverify false.
Can someone please help me with this?
You’re probably running into some SSL certificate and TLS problems. Type on terminal :
yum -y install ca-certificates openssl nss
Than retry again

Error: Could not parse application options: invalid option: --manifestdir

I was trying to install piwik-dev-environment. According to instructions I cloned the repo, installed Vagrant and executed vagrant up. The process ended with the following error:
Error: Could not parse application options: invalid option: --manifestdir
Full logs are here:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'trusty64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Box file was not detected as metadata. Adding it directly...
==> default: Adding box 'trusty64' (v0) for provider: virtualbox
default: Downloading: https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
default: Progress: 100% (Rate: 1170k/s, Estimated time remaining: --:--:--)
==> default: Successfully added box 'trusty64' (v0) for 'virtualbox'!
==> default: Importing base box 'trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: piwik-dev-environment_default_1438688840836_21904
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => D:/Git/piwik-dev-environment
default: /etc/puppet/files => D:/Git/piwik-dev-environment/puppet/files
default: /home/vagrant/www => D:/Git/piwik-dev-environment/www
default: /tmp/vagrant-puppet/modules-48bf73244a40076992a5cef90c07f471 => D:/Git/piwik-dev-environment/puppet/modules
default: /tmp/vagrant-puppet/manifests-768747907b90c39ab6f16fcb3320897a => D:/Git/piwik-dev-environment/puppet
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: ruby is already the newest version.
==> default: 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
==> default: Successfully installed facter-2.4.4
==> default: Successfully installed json_pure-1.8.2
==> default: Successfully installed hiera-3.0.1
==> default: Successfully installed puppet-4.2.1
==> default: 4 gems installed
==> default: Installing ri documentation for facter-2.4.4...
==> default: Installing ri documentation for json_pure-1.8.2...
==> default: Installing ri documentation for hiera-3.0.1...
==> default: Installing ri documentation for puppet-4.2.1...
==> default: Installing RDoc documentation for facter-2.4.4...
==> default: Installing RDoc documentation for json_pure-1.8.2...
==> default: Installing RDoc documentation for hiera-3.0.1...
==> default: Installing RDoc documentation for puppet-4.2.1...
==> default: Successfully installed hiera-3.0.1
==> default: 1 gem installed
==> default: Installing ri documentation for hiera-3.0.1...
==> default: Installing RDoc documentation for hiera-3.0.1...
==> default: Successfully installed hiera-1.3.4
==> default: Successfully installed hiera-puppet-1.0.0
==> default: 2 gems installed
==> default: Installing ri documentation for hiera-1.3.4...
==> default: Installing ri documentation for hiera-puppet-1.0.0...
==> default: Installing RDoc documentation for hiera-1.3.4...
==> default: Installing RDoc documentation for hiera-puppet-1.0.0...
==> default: Running provisioner: puppet...
==> default: Running Puppet with site.pp...
==> default: stdin: is not a tty
==> default: Error: Could not parse application options: invalid option: --manifestdir
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
I tried to find a file that contains the --manifestdir option but I didn't find any. I also tried to apply the same patch as in https://github.com/joebew42/diaspora-replica/issues/10 but it didn't help.
I'd appreciate any help.
I think that this was caused by a gem behavior.
I changed the SHELL provisioner to fetch and install the deb repo and installed the Puppet package for Ubuntu and I got past this issue.
config.vm.provision "shell", inline: <<-SHELL
if [ ! -f /deb-get ]; then wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb && sudo touch /deb-get; fi
if [ ! -f /deb-run ]; then sudo dpkg -i puppetlabs-release-trusty.deb && sudo touch /deb-run; fi
if [ ! -f /apt-get-run ]; then sudo apt-get update && sudo touch /apt-get-run; fi
if [ ! -f /apt-get-puppet ]; then sudo apt-get install --yes --force-yes puppet && sudo touch /apt-get-puppet; fi
SHELL
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet"
puppet.manifest_file = "site.pp"
puppet.module_path = "puppet/modules"
puppet.hiera_config_path = "hiera.yaml"
puppet.options = "--verbose --debug"
puppet.working_directory = "/tmp/vagrant-puppet"
puppet.facter = [
['fdqn', config.vm.hostname],
['db_username', CONF['db_username']],
['db_password', CONF['db_password']],
['ssh_username', CONF['ssh_username']],
]
end
This left the following issues:
==> default: Warning: Could not retrieve fact fqdn
==> default: Error: Could not find class apt for piwik-trusty64 on node piwik-trusty64
==> default: Error: Could not find class apt for piwik-trusty64 on node piwik-trusty64
But those are issues that can be fairly easily fixed.
It seems that you're trying to run the puppet provisioner with puppet4 installed on the guest machine. The --manifestsdir option is now deprecated and will cause an error. You have to add several parameters to your Vagrantfile to tell Vagrant that you're using the 4th version of Puppet.
The solution to your problem is described here: https://github.com/mitchellh/vagrant/pull/5601
Unfortunately the Piwik dev-environment project isn't maintained and doesn't work (a lot of issues are open in the tracker).
I have opened a pull request to embedded the Vagrant configuration straigth into Piwik's repository (which hopefully would be simpler to use too). Please comment in the pull request if you find it useful: https://github.com/piwik/piwik/pull/8542

"vagrant up --provision" fails ("vagrant up" is fine)

I am trying to make incrementatal changes to the cookbook for a vagrant server. "vagrant destroy" followed by a "vagrant up" works perfectly but "vagrant up --provision" errors out as below. The files all appear to exist.
It seems weird that when provisioning for the first time they would work perfectly and then fail on the reprovisioning. Any idea what I might be doing wrong?
==> default: Running provisioner: shell...
default: Running: inline script
==> default: /usr/bin/chef-solo
==> default: Running provisioner: shell...
default: Running: inline script
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: [2015-04-01T05:42:20+00:00] INFO: Forking chef instance to converge...
==> default: [2015-04-01T05:42:20+00:00] INFO: *** Chef 12.2.1 ***
==> default: [2015-04-01T05:42:20+00:00] INFO: Chef-client pid: 3710
==> default: [2015-04-01T05:42:21+00:00] INFO: Setting the run_list to ["role[A]", "role[B]"] from CLI options
==> default: [2015-04-01T05:42:21+00:00] ERROR: Role A (included by 'top level') is in the runlist but does not exist. Skipping expand.
==> default: [2015-04-01T05:42:21+00:00] ERROR: Role B (included by 'top level') is in the runlist but does not exist. Skipping expand.
==> default:
==> default:
==> default: ================================================================================
==> default: Error expanding the run_list:
==> default: ================================================================================
==> default:
==> default: Missing Role(s) in Run List:
==> default: ----------------------------
==> default: * A included by 'top level'
==> default: * B included by 'top level'
==> default:
==> default: Original Run List
==> default: -----------------
==> default: * role[A]
==> default: * role[B]
==> default:
==> default:
==> default: [2015-04-01T05:42:21+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-04-01T05:42:21+00:00] ERROR: The expanded run list includes nonexistent roles: A, B
==> default: [2015-04-01T05:42:22+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Provisioning vagrant box with chef_ solo

I'm having a problem with the chef-solo provisioner failing with the error
Chef::Exceptions::CookbookNotFound: Cookbook apt not found.
Any ideas on what could be going wrong here and how should I try to troubleshoot this?
Host: Windows 7 64bit, Guest: Ubuntu 12.04
Virtualbox 4.3.20
ChefDK 0.4.0
Vagrant 1.7.2
Vagrant plugins:
vagrant-berkshelf (4.0.2)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.3, system)
Vagrant output:
PS C:\VagrantBoxes\mybox> vagrant reload --provision
default: The Berkshelf shelf is at "C:/Users/dmit77/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150208-6588-1a3oox5-default"
==> default: Sharing cookbooks with VM
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.12
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => C:/VagrantBoxes/mybox
default: /tmp/vagrant-chef/7159cf65a6eea91634c03008165d96a8/cookbooks => C:/Users/dkrantsber/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150208-6588-1a3oox5-default
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-02-08T05:09:07+00:00] INFO: *** Chef 11.4.0 ***
==> default: [2015-02-08T05:09:08+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[apache2]"] from JSON
==> default: [2015-02-08T05:09:08+00:00] INFO: Run List is [recipe[apt], recipe[apache2]]
==> default: [2015-02-08T05:09:08+00:00] INFO: Run List expands to [apt, apache2]
==> default: [2015-02-08T05:09:08+00:00] INFO: Starting Chef Run for vagrant.vm
==> default: [2015-02-08T05:09:08+00:00] INFO: Running start handlers
==> default: [2015-02-08T05:09:08+00:00] INFO: Start handlers complete.
==> default: [2015-02-08T05:09:08+00:00] ERROR: Running exception handlers
==> default: [2015-02-08T05:09:08+00:00] ERROR: Exception handlers complete
==> default: [2015-02-08T05:09:08+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-02-08T05:09:08+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook apt not found. If you're loading apache2 from another cookbook, make sure you confi
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Vagrant file:
Vagrant.configure("2") do |config|
config.vm.box = "opscode-ubuntu-12.04_chef-11.4.0"
config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.0.box"
config.ssh.forward_agent = true
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks"]
chef.add_recipe :'apt'
chef.add_recipe 'apache2'
chef.json = {
:apache => {
:default_site_enabled => "true",
:dir => "/etc/apache2",
:log_dir => "/var/log/apache2",
:error_log => "error.log"
}
}
end
end
Folder structure:
[my_box]
[cookbooks]
[apt]
[apache2]
Vagrantfile
I finally came across the solution. It turns out that vagrant-berkshelf plugin is the problem. Uninstalling it resolves the issue.
Vagrant & Chef - Cookbook *** not found

chef solo - vagrant build error

Ive been struggling with this for hours and dont seem to be making any progress. Any tips on where I should start debugging this would be appreciated.
I am attempting to provision a vagrant machine and get the following error.
`==> default: Running provisioner: chef_solo...
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2014-05-14T11:16:08+00:00] INFO: *** Chef 10.14.2 ***
==> default: [2014-05-14T11:16:08+00:00] INFO: Setting the run_list to ["recipe[nginx]"] from JSON
==> default: [2014-05-14T11:16:08+00:00] INFO: Run List is [recipe[nginx]]
==> default: [2014-05-14T11:16:08+00:00] INFO: Run List expands to [nginx]
==> default: [2014-05-14T11:16:08+00:00] INFO: Starting Chef Run for precise64
==> default: [2014-05-14T11:16:08+00:00] INFO: Running start handlers
==> default: [2014-05-14T11:16:08+00:00] INFO: Start handlers complete.
==> default:
==> default: ================================================================================
==> default: Recipe Compile Error in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/build-essential/libraries/xcode_command_line_tools.rb
==> default: ================================================================================
==> default:
==> default: NameError
==> default: ---------
==> default: uninitialized constant Chef::Resource::LWRPBase
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/build-essential/libraries/xcode_command_line_tools.rb:21
==> default:
==> default: Relevant File Content:
==> default: ----------------------
==> default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks/build-essential/libraries/xcode_command_line_tools.rb:
==> default:
==> default: 1: #
==> default: 2: # Cookbook Name:: build-essential
==> default: 3: # Library:: xcode_command_line_tools
==> default: 4: #
==> default: 5: # Copyright 2014, Chef Software, Inc.
==> default: 6: #
==> default: 7: # Licensed under the Apache License, Version 2.0 (the "License");
==> default: 8: # you may not use this file except in compliance with the License.
==> default: 9: # You may obtain a copy of the License at
==> default: [2014-05-14T11:16:09+00:00] ERROR: Running exception handlers
==> default: [2014-05-14T11:16:09+00:00] ERROR: Exception handlers complete
==> default: [2014-05-14T11:16:09+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2014-05-14T11:16:09+00:00] FATAL: NameError: uninitialized constant Chef::Resource::LWRPBase
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.`
I am using the berkshelf-vagrant plugin with vagrant
Vagrant 1.6.2
My vagrant file has the following:
config.vm.provision :chef_solo do |chef|
chef.run_list = [
"recipe[nginx]"
]
end
You are using a very old version of Chef. You might want to use vagrant-omnibus to install a more modern Chef version in your box.
Your issue looks very similar to COOK-4441. Reason: Chef 10, while 11 is required.

Resources