sous-chefs / nginx

Development repository for the nginx cookbook
https://supermarket.chef.io/cookbooks/nginx
Apache License 2.0
553 stars 806 forks source link

Install fails on Amazon Machine Linux 2 #461

Closed tomharvey closed 6 years ago

tomharvey commented 6 years ago

Cookbook version

8.1.2

Chef-client version

12.15.19

Platform Details

Amazon Machine Linux 2 - gbailey/amzn2 vagrant file

Scenario:

Running the default receipt for this cookbook fails.

Looks like https://github.com/chef-cookbooks/nginx/blob/22a1b6365755782e82067d61ab34a0569c5c1704/attributes/repo.rb#L30 is assuming that all amazon platform should use the rhel6 rpm. But Amazon Machine Linux 2 requires rhel7.

AML2 also changes its name /etc/system-release more often than the artist formerly known as Prince.

Steps to Reproduce:

Use a kitchen config file as below:

driver:
  name: vagrant

provisioner:
  name: chef_zero
  product_name: chef
  product_version: 12.15.19

verifier:
  name: inspec

platforms:
  - name: aml2
    driver_config:
      box: gbailey/amzn2

and then include the default recipe of this package and kitchen converge it.

Expected Result:

I expect it to converge.

Actual Result:

It doesn't converge. The key parts of the STDERR message which lead me to the line of code above are:

       Recipe: nginx::repo
         * yum_repository[nginx] action create
           * template[/etc/yum.repos.d/nginx.repo] action create
             - create new file /etc/yum.repos.d/nginx.repo
             - update content in file /etc/yum.repos.d/nginx.repo from none to 5dd569
             --- /etc/yum.repos.d/nginx.repo    2018-07-06 22:29:24.762631382 +0000
             +++ /etc/yum.repos.d/.chef-nginx20180706-11778-i9ymot.repo 2018-07-06 22:29:24.762631382 +0000
             @@ -1 +1,10 @@
             +# This file was generated by Chef
             +# Do NOT modify this file by hand.
             +
             +[nginx]
             +name=Nginx.org Repository
             +baseurl=https://nginx.org/packages/rhel/6/$basearch/

and

           Chef::Exceptions::Exec
           ----------------------
           yum -d0 -e0 -y --disablerepo=* --enablerepo=nginx install nginx-1.14.0-1.el6.ngx returned 1:
           STDOUT:  You could try using --skip-broken to work around the problem
            You could try running: rpm -Va --nofiles --nodigest

           STDERR: Error: Package: nginx-1.14.0-1.el6.ngx.x86_64 (nginx)
               Requires: libpcre.so.0()(64bit)
siulcode commented 6 years ago

Any ETA or workaround on this one. We are testing the same on Linux 2 and still getting the same rhel6 error.

tomharvey commented 6 years ago

I would assume it’s somewhat dependent on https://github.com/chef/ohai/pull/1214 being released, which will allow the project to correctly get platform info from ohai

tas50 commented 6 years ago

You'll want to upgrade to the latest Chef 13 or 14 to get support for Amazon Linux 2. Chef 12 does not support that release.

rohityadav225 commented 5 years ago

@tas50 I am facing the same issue with Chef 13 and 14.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.