Search code examples
chef-infratest-kitchen

Error executing action `install` on resource | Kitchen | Vagrant 2.1 | Virtual Box 5.2


i am trying to converge my kitchen instances created on CentOS 7 and only one line in recipe to install nginx package.

# Cookbook:: vmaas
# Recipe:: default
#
# Copyright:: 2018, The Authors, All Rights Reserved.
package "nginx"

However the converge fails with error as below:

Error executing action install on resource 'yum_package[nginx]' ========================================================================

       Chef::Exceptions::Package
       -------------------------
       No candidate version available for nginx

Resource Declaration:

       ---------------------
       # In /tmp/kitchen/cache/cookbooks/vmaas/recipes/default.rb

         6: package "nginx"

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cache/cookbooks/vmaas/recipes/default.rb:6:in `from_file'

the .kitchen.yml looks like below:

---
driver:
  name: vagrant

provisioner:
  name: chef_zero
  # You may wish to disable always updating cookbooks in CI or other testing environments.
  # For example:
  #   always_update_cookbooks: <%= !ENV['CI'] %>
  chef_omnibus_url: http://www.chef.io/chef/install.sh
  require_chef_omnibus: 12.7.2
  always_update_cookbooks: false
  transport:
    user: vagrant
  #always_update_cookbooks: true

verifier:
  name: inspec

platforms:
  - name: centos
    driver:
      box: target/centos7
      #box_check_update: true
      box_url: 'https://binrepo.target.com/artifactory/marketing/boxes/centos7.json'

suites:
  - name: default
    run_list:
      - recipe[vmaas::default]
    verifier:
      inspec_tests:
        - test/smoke/default
    attributes:

It would be great if i can get some guidance on the same.

Regards, Sunil


Solution

  • To the best of my knowledge, CentOS 7 does not include an Nginx package.

    $  docker run centos:7 yum search nginx
    Loaded plugins: fastestmirror, ovl
    Determining fastest mirrors
     * base: mirror.team-cymru.org
     * extras: mirror.steadfast.net
     * updates: centos.mirror.constant.com
    ============================== N/S matched: nginx ==============================
    pcp-pmda-nginx.x86_64 : Performance Co-Pilot (PCP) metrics for the Nginx
                          : Webserver
    
      Name and summary matches only, use "search all" for everything.
    

    You'll need to provide some other repo which includes nginx.