sous-chefs / jenkins

Development repository for the jenkins cookbook
https://supermarket.chef.io/cookbooks/jenkins
Apache License 2.0
424 stars 635 forks source link

Forcibly upgrade config file. #691

Closed don-code closed 3 years ago

don-code commented 6 years ago

Description

This cookbook maintains the config file /etc/default/jenkins on Debian and derivatives. If upstream maintainers change this file in a new package version, apt will fail to install it and error out.

The change here forces the cookbook to use the local copy of /etc/default/jenkins, as it is under management and will berewritten on every converge anyway.

Sample error being fixed:

         * apt_package[jenkins] action install[2018-08-01T04:27:23+00:00] INFO: Processing apt_package[jenkins] action install (jenkins::_master_package line 47)

           ================================================================================
           Error executing action `install` on resource 'apt_package[jenkins]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           Expected process to exit with [0], but received '100'
           ---- Begin output of ["apt-get", "-q", "-y", "install", "jenkins=2.121.2"] ----
           STDOUT: Reading package lists...
           Building dependency tree...
           Reading state information...
           The following packages will be upgraded:
             jenkins
           1 upgraded, 0 newly installed, 0 to remove and 163 not upgraded.
           Need to get 74.5 MB of archives.
           After this operation, 170 kB of additional disk space will be used.
           Fetched 74.5 MB in 18s (3984 kB/s)
           (Reading database ... 69180 files and directories currently installed.)
           Preparing to unpack .../jenkins_2.121.2_all.deb ...
            * Stopping Jenkins Automation Server jenkins
       ...done.
           Unpacking jenkins (2.121.2) over (2.107.2) ...
           Processing triggers for ureadahead (0.100.0-16) ...
           Setting up jenkins (2.121.2) ...
           STDERR: Configuration file '/etc/default/jenkins'
            ==> Modified (by you or by a script) since installation.
            ==> Package distributor has shipped an updated version.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions
          Z     : start a shell to examine the situation
            The default action is to keep your current version.
           *** jenkins (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing package jenkins (--configure):
            EOF on stdin at conffile prompt
           Errors were encountered while processing:
            jenkins
           E: Sub-process /usr/bin/dpkg returned an error code (1)
           ---- End output of ["apt-get", "-q", "-y", "install", "jenkins=2.121.2"] ----
           Ran ["apt-get", "-q", "-y", "install", "jenkins=2.121.2"] returned 100

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/jenkins/recipes/_master_package.rb

            47: package 'jenkins' do
            48:   version node['jenkins']['master']['version']
            49: end
            50: 

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/jenkins/recipes/_master_package.rb:47:in `from_file'

           apt_package("jenkins") do
             package_name "jenkins"
             action [:install]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :package
             cookbook_name "jenkins"
             recipe_name "_master_package"
             version "2.121.2"
           end

Issues Resolved

N/A

Check List

xorima commented 3 years ago

Closing due to inactivity.

If this is still wanted please reopen or open another pull request. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help!

Thanks, Sous-Chefs