在资源上执行“安装”操作时出错 |厨房 |流浪汉 2.1 |虚拟盒子 5.2

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

我正在尝试收敛我在 CentOS 7 上创建的厨房实例,并且在配方中只有一行来安装 nginx 包。

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

但是收敛失败,错误如下:

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'

.kitchen.yml 如下所示:

---
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:

如果我能得到一些相同的指导,那就太好了。

此致, 苏尼尔

据我所知,CentOS 7 不包含 Nginx 软件包。

$  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.

您需要提供一些其他的 repo,其中包括 nginx。