【问题标题】:Error executing action `install` on resource | Kitchen | Vagrant 2.1 | Virtual Box 5.2对资源执行操作“安装”时出错 |厨房 |流浪者 2.1 |虚拟盒子 5.2
【发布时间】:2018-02-10 02:20:03
【问题描述】:

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

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

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

在资源 'yum_package[nginx]' 上执行操作 install 时出错 ==================================================== =======================

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

资源声明:

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

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

问候, 苏尼尔

【问题讨论】:

  • 不是应该显式启用的 EPEL 的 nginx 部分吗?

标签: chef-infra test-kitchen


【解决方案1】:

据我所知,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.

您需要提供一些包含 nginx 的其他 repo。

【讨论】:

  • 那是因为 RHEL/CentOS 上的包名是git-all。如果您不熟悉系统管理,Chef 不会帮助您。您需要明确知道要告诉该工具做什么。
  • 我在 OpenStack 云上使用服务器配置已经很长时间了。是否有任何网站可以检查具有匹配操作系统版本的软件包名称。
  • yum search 仍然是唯一的官方选项。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多