在 Chef 中对资源“dnf_package[httpd]”执行操作“install”时出错

问题描述 投票:0回答:1

我正在尝试从 CHEF 安装 APACHE 服务器。遇到以下错误。 操作系统 - 亚马逊Linux

食谱:-

package 'httpd' do
  action :install
end

file '/var/www/html/index.html' do
  content "Ktexperts is a knowledge sharing platform"
  action :create
end

service 'httpd' do
  action [ :enable, :start ]
end

代码

chef-client -zr "recipe[ayan-apache::ayan-apache]"

错误

* dnf_package[httpd] action install

    ============================================================================                                             ====
    Error executing action `install` on resource 'dnf_package[httpd]'
    ============================================================================                                             ====

    RuntimeError
    ------------
    dnf-helper.py had stderr output:

    Errors during downloading metadata for repository 'amazonlinux':
      - Curl error (3): URL using bad/illegal format or missing URL for https://                                             al2023-repos-$awsregion-de612dc2.s3.dualstack.$awsregion.$awsdomain/core/mirrors                                             /2023.1.20230705/x86_64/mirror.list []
    Traceback (most recent call last):
      File "/usr/lib/python3.9/site-packages/dnf/repo.py", line 573, in load
        ret = self._repo.load()
      File "/usr/lib64/python3.9/site-packages/libdnf/repo.py", line 331, in loa                                             d
        return _repo.Repo_load(self)
    libdnf._error.Error: Failed to download metadata for repo 'amazonlinux': Can                                             not prepare internal mirrorlist: Curl error (3): URL using bad/illegal format or                                              missing URL for https://al2023-repos-$awsregion-de612dc2.s3.dualstack.$awsregio                                             n.$awsdomain/core/mirrors/2023.1.20230705/x86_64/mirror.list []

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.0.30                                             0/lib/chef/provider/package/dnf/dnf_helper.py", line 92, in <module>
        query(command)
      File "/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.0.30                                             0/lib/chef/provider/package/dnf/dnf_helper.py", line 38, in query
        sack = get_sack()
      File "/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.0.30                                             0/lib/chef/provider/package/dnf/dnf_helper.py", line 18, in get_sack
        base.fill_sack()
      File "/usr/lib/python3.9/site-packages/dnf/base.py", line 401, in fill_sac                                             k
        self._add_repo_to_sack(r)
      File "/usr/lib/python3.9/site-packages/dnf/base.py", line 141, in _add_rep                                             o_to_sack
        repo.load()
      File "/usr/lib/python3.9/site-packages/dnf/repo.py", line 580, in load
        raise dnf.exceptions.RepoError(str(e))
    dnf.exceptions.RepoError: Failed to download metadata for repo 'amazonlinux'                                             : Cannot prepare internal mirrorlist: Curl error (3): URL using bad/illegal form                                             at or missing URL for https://al2023-repos-$awsregion-de612dc2.s3.dualstack.$aws                                             region.$awsdomain/core/mirrors/2023.1.20230705/x86_64/mirror.list []

    Resource Declaration:
    ---------------------
    # In /root/.chef/local-mode-cache/cache/cookbooks/ayan-apache/recipes/ayan-a                                             pache.rb

      7: package 'httpd' do
      8:   action :install
      9: end
     10:

    Compiled Resource:
    ------------------
    # Declared in /root/.chef/local-mode-cache/cache/cookbooks/ayan-apache/recip                                             es/ayan-apache.rb:7:in `from_file'

    dnf_package("httpd") do
      package_name "httpd"
      action [:install]
      default_guard_interpreter :default
      declared_type :package
      cookbook_name "ayan-apache"
      recipe_name "ayan-apache"
    end

    System Info:
    ------------
    chef_version=15.0.300
    platform=amazon
    platform_version=2023
    ruby=ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
    program_name=/usr/bin/chef-client
    executable=/opt/chef-workstation/bin/chef-client


Running handlers:
[2023-08-01T02:56:51+00:00] ERROR: Running exception handlers
Running handlers complete
[2023-08-01T02:56:51+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 03 seconds
[2023-08-01T02:56:51+00:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-c                                             ache/cache/chef-stacktrace.out
[2023-08-01T02:56:51+00:00] FATAL: Please provide the contents of the stacktrace                                             .out file if you file a bug report
[2023-08-01T02:56:51+00:00] FATAL: RuntimeError: dnf_package[httpd] (ayan-apache                                             ::ayan-apache line 7) had an error: RuntimeError: dnf-helper.py had stderr outpu                                             t:

Errors during downloading metadata for repository 'amazonlinux':
  - Curl error (3): URL using bad/illegal format or missing URL for https://al20                                             23-repos-$awsregion-de612dc2.s3.dualstack.$awsregion.$awsdomain/core/mirrors/202                                             3.1.20230705/x86_64/mirror.list []
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/dnf/repo.py", line 573, in load
    ret = self._repo.load()
  File "/usr/lib64/python3.9/site-packages/libdnf/repo.py", line 331, in load
    return _repo.Repo_load(self)
libdnf._error.Error: Failed to download metadata for repo 'amazonlinux': Cannot                                              prepare internal mirrorlist: Curl error (3): URL using bad/illegal format or mis                                             sing URL for https://al2023-repos-$awsregion-de612dc2.s3.dualstack.$awsregion.$a                                             wsdomain/core/mirrors/2023.1.20230705/x86_64/mirror.list []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.0.300/li                                             b/chef/provider/package/dnf/dnf_helper.py", line 92, in <module>
    query(command)
  File "/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.0.300/li                                             b/chef/provider/package/dnf/dnf_helper.py", line 38, in query
    sack = get_sack()
  File "/opt/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.0.300/li                                             b/chef/provider/package/dnf/dnf_helper.py", line 18, in get_sack
    base.fill_sack()
  File "/usr/lib/python3.9/site-packages/dnf/base.py", line 401, in fill_sack
    self._add_repo_to_sack(r)
  File "/usr/lib/python3.9/site-packages/dnf/base.py", line 141, in _add_repo_to                                             _sack
    repo.load()
  File "/usr/lib/python3.9/site-packages/dnf/repo.py", line 580, in load
    raise dnf.exceptions.RepoError(str(e))
dnf.exceptions.RepoError: Failed to download metadata for repo 'amazonlinux': Ca                                             nnot prepare internal mirrorlist: Curl error (3): URL using bad/illegal format o                                             r missing URL for https://al2023-repos-$awsregion-de612dc2.s3.dualstack.$awsregi                                             on.$awsdomain/core/mirrors/2023.1.20230705/x86_64/mirror.list []

我正在尝试从 Chef 客户端安装 apache 服务器。 代码中没有发现错误。 Syntex 在 ruby 中显示正常。 无法找到或下载 httpd 文件并显示错误。

请帮忙。

devops chef-infra cookbook
1个回答
0
投票

即使我遇到了同样的错误,你能帮我解决这个错误吗

<< Error executing action

install
资源“dnf_package[httpd]”>>

下面是命令 Chef-client -zr“食谱[apache-cookbook::r5]”

© www.soinside.com 2019 - 2024. All rights reserved.