sous-chefs / nginx

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

Installed package is newer than candidate package after yum upgrade #446

Closed fletchowns closed 6 years ago

fletchowns commented 6 years ago

Cookbook version

7.0.2

Chef-client version

12.20.3

Platform Details

Redhat 7.4 on AWS

Scenario:

1.12.1 was previously installed by nginx cookbook. A subsequent yum upgrade installed 1.12.2. Now converge is failing due to nginx cookbook trying to install 1.12.1 again.

Steps to Reproduce:

Use the cookbook to install 1.12.1, run a yum update && yum upgrade to install 1.12.2. Run converge again and it fails.

I tried setting override["nginx"]["version"] = "1.12.2" but it still failed trying to install 1.12.1. I'm not sure why it's setting version to 1.12.1-1.el7.ngx in the output below.

Expected Result:

Converge should not fail

Actual Result:

* yum_package[nginx] action install[2017-11-23T00:44:13+00:00] INFO: Processing yum_package[nginx] action install (nginx::package line 43)

  ================================================================================
  Error executing action `install` on resource 'yum_package[nginx]'
  ================================================================================

  Chef::Exceptions::Package
  -------------------------
  Installed package nginx-1.12.2-1.el7_4.ngx is newer than candidate package nginx-1.12.1-1.el7.ngx

  Resource Declaration:
  ---------------------
  # In /var/chef/cache/cookbooks/nginx/recipes/package.rb

   43: package node['nginx']['package_name'] do
   44:   options package_install_opts
   45:   notifies :reload, 'ohai[reload_nginx]', :immediately
   46: end
   47: 

  Compiled Resource:
  ------------------
  # Declared in /var/chef/cache/cookbooks/nginx/recipes/package.rb:43:in `from_file'

  yum_package("nginx") do
    package_name "nginx"
    action [:install]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    declared_type :package
    cookbook_name "nginx"
    recipe_name "package"
    options "--disablerepo=* --enablerepo=nginx"
    version "1.12.1-1.el7.ngx"
    flush_cache {:before=>false, :after=>false}
    only_if { #code block }
  end
fletchowns commented 6 years ago

Sounds similar to #441

fletchowns commented 6 years ago

Ugh, I forgot I had put in the edit_resource workaround for #441, no wonder it was still trying to install the older version! Closing this out.

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.