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

351 views Asked by At

I am trying to install APACHE server from CHEF. Encounter below error. OS - Amazon Linux

Recipe :-

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

Code

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

ERROR

* 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 []

I am trying to install apache server from Chef Client. No error found in code. Syntex showing ok in ruby. It's unable to locate or download httpd file and showing error.

Please help.

0

There are 0 answers