How do I specify the cookbook path in the .kitchen.yml file to provide chef_solo preparation?

I want to specify cookbook paths using chef_solo as a security tool in a test kitchen. We are not currently using Berkshelf or chef_zero.

I am setting cookbooks_path to my .kitchen.yml file but it looks like the chef_solo helper is ignoring this flag. See Stack Trace below.

.kitchen.yml

---
driver:
  name: vagrant

provisioner:
  name: chef_solo
  require_chef_omnibus: 11.8.0
  roles_path: '../../roles'
  data_bags_path: '../../data_bags'
  environments_path: '../../environments'
  cookbooks_path: '../cookbooks, ../../site-cookbooks'

      

Stack trace:

$ kitchen converge analytics-centos-65
-----> Starting Kitchen (v1.2.1)
-----> Converging <analytics-centos-65>...
       Preparing files for transfer
       Resolving cookbook dependencies with Berkshelf 3.2.1...
       Removing non-cookbook files before transfer
       Preparing data bags
       Preparing environments
       Preparing roles
       Transfering files to <analytics-centos-65>
       [2015-01-07T18:07:06+00:00] INFO: Forking chef instance to converge...
       Starting Chef Client, version 11.8.0
       [2015-01-07T18:07:06+00:00] INFO: *** Chef 11.8.0 ***
       [2015-01-07T18:07:06+00:00] INFO: Chef-client pid: 4294
       [2015-01-07T18:07:06+00:00] INFO: Setting the run_list to ["role[default]", "role[test]", "role[development]", "role[etl]", "role[ets]", "role[log_consolidator]"] from JSON
       [2015-01-07T18:07:06+00:00] INFO: Run List is [role[default], role[test], role[development], role[etl], role[ets], role[log_consolidator]]
       [2015-01-07T18:07:06+00:00] INFO: Run List expands to [sysctl::attribute_driver, yum::epel, ad-summos::timezone, ad-summos::ntpd, ad-summos::users, ad-summos::pgpass, ad-summos::fix_adsummos_dir_permissions, ad-summos::ec2-keys, ad-summos::sudo, ad-summos::aws, ad-summos::git, ad-summos::bashrc, ad-summos::setup-additional-adsummos-directories, ad-summos::aws-adsummos-user, ad-summos::denyhosts, ad-summos::p7zip, ad-summos::set_firewall_rules, ad-summos::system-tools, ad-summos::deploy_analytics_code, vsftpd, users::development, ad-summos::setup_hostname, etl::configure_etl, ad-summos::mysql-client, ad-summos::postgresql-devel, etl::pdi-tools-42, etl::create_etl_folders, etl::system-wide-rvm-permissions, etl::user_agent_utils, etl::pgpass-adsummos-user, ets::ets-install, ets::varnish-install, ets::sftp-user, ad-summos::sinatra, log_consolidator::configure_log_consolidator, log_consolidator::log_cron_crontab, log_consolidator::install_consolidator_packages]
       [2015-01-07T18:07:06+00:00] INFO: Starting Chef Run for analytics-centos-65
       [2015-01-07T18:07:06+00:00] INFO: Running start handlers
       [2015-01-07T18:07:06+00:00] INFO: Start handlers complete.
       Compiling Cookbooks...
       [2015-01-07T18:07:06+00:00] ERROR: Running exception handlers
       [2015-01-07T18:07:06+00:00] ERROR: Exception handlers complete
       [2015-01-07T18:07:06+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       Chef Client failed. 0 resources updated
       [2015-01-07T18:07:06+00:00] ERROR: Cookbook sysctl not found. If you're loading sysctl from another cookbook, make sure you configure the dependency in your metadata
       [2015-01-07T18:07:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> Converge failed on instance <analytics-centos-65>.
>>>>>> Please see .kitchen/logs/analytics-centos-65.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E chef-solo --config /tmp/kitchen/solo.rb --json-attributes /tmp/kitchen/dna.json  --log_level info]
>>>>>> ----------------------

      

Related: How to Specify Cookbook Path in .kitchen.yml File?

I see sethvargo's answer to provide with chef_zero, but we're locked out on Chef Zero because a sheer number of our environments and roles are configured in Ruby, not JSON. https://github.com/opscode/chef-zero/issues/107 . Likewise, Berkshelf is an iteration or two ahead of where we are in our code migration.

Is there a way to specify the local cookbook paths with the chef_solo helper?

+3


source to share


3 answers


  I cannot speak for this place in Yamla. However, I was able to get it to work using the line in knife.rb

Sounds correct to me, but remember that config.rb takes precedence now since Chef Client 12.0.

The docs are good to describe this, but keep in mind the attributes others have described:

The default config.rb location is:



~/.chef/config.rb

      

Cookbook path syntax:

cookbook_path ["/ full / path / to / repo / cookbooks"]

And reboot the chef to check.

+1


source


It should be an array in Yaml:



provisioner:
  name: chef_solo
  require_chef_omnibus: 11.8.0
  roles_path: '../../roles'
  data_bags_path: '../../data_bags'
  environments_path: '../../environments'
  cookbooks_path:
    - ../cookbooks
    - ../../site-cookbooks

      

0


source


I cannot speak for this place in Yamla. However, I was able to get it to work using the line in knife.rb

cookbook_path ["/ full / path / to / repo / cookbooks"]

using this in the knife.rb repo where i was working in the kitchen let it work.

0


source







All Articles