Update more cookbooks

This commit is contained in:
Greg Karékinian
2017-06-16 11:25:49 +02:00
parent 7da2c5a738
commit f5858319a7
129 changed files with 1095 additions and 101571 deletions

View File

@@ -1 +0,0 @@
~FC016

View File

@@ -2,6 +2,23 @@
This file is used to list changes made in each version of the chef_client_updater cookbook.
## 1.1.1 (2017-05-11)
- Fix the initial load of mixlib-install failing
## 1.1.0 (2017-05-10)
- Add support for download URL overrides via new properties on the resource and attributes for the default recipe. This requires mixlib-install 3.2.1, which we now ensure we install in the updater resource.
- Update the default post_install action in the recipe to match the resource (exec).
- Remove usage of class_eval in the resource since we use compat_resource and class_eval causes issues with some later Chef 12 releases.
- Fix the solaris platform name in the metadata.rb.
- Remove disabling FC016 and FC023 Foodcritic rules as these no longer alert.
- Avoid infinite loops if trying to install the latest chef-client version from any channel.
- Add a true test recipe and remove unused inspec tests
- Add debug logging of the current vs. desired versions to help troubleshooting
- Added a blurb in the readme outlining init system issues surrounding kill and the chef-client starting back up
## 1.0.2 (2017-04-07)
- Fix Chef 13 compatibility by using Kernel.exec not exec

View File

@@ -18,10 +18,16 @@ This cookbook updates the chef-client
- compat_resource
### Usage
## Usage
This cookbook provides both a custom resource and a default recipe. The default recipe simply uses the custom resource with a set of attributes. You can add chef_client_updater::default to your run list or use the custom resource in a wrapper cookbook.
### Init System Caveats
When Chef runs as a service under a system init daemon such as Sys-V or systemd each chef run forks off from the main chef-client process being managed by the init system. For a chef-client upgrade to occur the running chef-client as well as the parent process must be killed, and a new chef-client must start using the updated binaries. This cookbook handles killing the chef-client, but your init system must properly handle starting the service back up. For systemd and upstart this can be handled via configuration, and chef-client cookbook 8.1.1 or later handles this by default. This functionality is not available in sys-v (RHEL 6, Debian 7, and others), so you will need to employ a secondary process such as a monitoring system to start the chef-client service.
## Resources
### chef_client_updater
Installs the mixlib-install/mixlib-install gems and upgrades the chef-client.
@@ -34,6 +40,8 @@ Installs the mixlib-install/mixlib-install gems and upgrades the chef-client.
- `post_install_action` - After installing the chef-client what should we do. `exec` to exec the new client or `kill` to kill the client and rely on the init system to start up the new version. Default: `exec`
- `exec_command` - The chef-client command. default: $PROGRAM_NAME.split(' ').first
- `exec_args` - An array of arguments to exec the chef-client with. default: ARGV
- `download_url_override` - The direct URL for the chef-client package.
- `checksum` - The SHA-256 checksum of the chef-client package from the direct URL.
#### examples

View File

@@ -26,4 +26,10 @@ default['chef_client_updater']['prevent_downgrade'] = true
default['chef_client_updater']['version'] = 'latest'
# kill the client post install or exec the client post install for non-service based installs
default['chef_client_updater']['post_install_action'] = 'kill'
default['chef_client_updater']['post_install_action'] = 'exec'
# the download URL (for use in an air-gapped environment)
default['chef_client_updater']['download_url_override'] = nil
# the checksum of the package from "download_url_override"
default['chef_client_updater']['checksum'] = nil

View File

@@ -1 +1 @@
{"name":"chef_client_updater","version":"1.0.2","description":"Upgrades chef-client to specified releases","long_description":"Upgrades chef-client to specified releases","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","mac_os_x":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","solaris":">= 0.0.0","suse":">= 0.0.0","ubuntu":">= 0.0.0","windows":">= 0.0.0","aix":">= 0.0.0"},"dependencies":{"compat_resource":">= 12.16.3"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/chef_client_updater","issues_url":"https://github.com/chef-cookbooks/chef_client_updater/issues","chef_version":[[">= 12.1"]],"ohai_version":[]}
{"name":"chef_client_updater","version":"1.1.1","description":"Upgrades chef-client to specified releases","long_description":"Upgrades chef-client to specified releases","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"amazon":">= 0.0.0","centos":">= 0.0.0","debian":">= 0.0.0","mac_os_x":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","oracle":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","solaris2":">= 0.0.0","suse":">= 0.0.0","ubuntu":">= 0.0.0","windows":">= 0.0.0","aix":">= 0.0.0"},"dependencies":{"compat_resource":">= 12.16.3"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/chef_client_updater","issues_url":"https://github.com/chef-cookbooks/chef_client_updater/issues","chef_version":[[">= 12.1"]],"ohai_version":[]}

View File

@@ -22,4 +22,6 @@ chef_client_updater 'update chef-client' do
version node['chef_client_updater']['version']
prevent_downgrade node['chef_client_updater']['prevent_downgrade']
post_install_action node['chef_client_updater']['post_install_action']
download_url_override node['chef_client_updater']['download_url_override'] if node['chef_client_updater']['download_url_override']
checksum node['chef_client_updater']['checksum'] if node['chef_client_updater']['checksum']
end

View File

@@ -26,9 +26,11 @@ property :version, [String, Symbol], default: :latest
property :post_install_action, String, default: 'exec'
property :exec_command, String, default: $PROGRAM_NAME.split(' ').first
property :exec_args, Array, default: ARGV
property :download_url_override, String
property :checksum, String
action :update do
if update_necessary? # ~FC023
if update_necessary?
converge_by "Upgraded chef-client #{current_version} to #{desired_version}" do
upgrade_command = Mixlib::ShellOut.new(mixlib_install.install_command)
upgrade_command.run_command
@@ -37,12 +39,14 @@ action :update do
end
end
action_class.class_eval do
action_class do
def load_mixlib_install
gem 'mixlib-install', '~> 3.2', '>= 3.2.1'
require 'mixlib/install'
rescue LoadError
Chef::Log.info('mixlib-install gem not found. Installing now')
chef_gem 'mixlib-install' do
version '>= 3.2.1'
compile_time true if respond_to?(:compile_time)
end
@@ -69,6 +73,9 @@ action_class.class_eval do
product_version: new_resource.version == 'latest' ? :latest : new_resource.version,
}
if new_resource.download_url_override && new_resource.checksum
options[:install_command_options] = { download_url_override: new_resource.download_url_override, checksum: new_resource.checksum }
end
Mixlib::Install.new(options)
end
@@ -80,7 +87,7 @@ action_class.class_eval do
end
def desired_version
new_resource.version == 'latest' ? mixlib_install.available_versions.last : new_resource.version
new_resource.version.to_sym == :latest ? mixlib_install.available_versions.last : new_resource.version
end
# why wouldn't we use the built in update_available? method in mixlib-install?
@@ -90,6 +97,7 @@ action_class.class_eval do
load_mixlib_versioning
cur_version = Mixlib::Versioning.parse(current_version)
des_version = Mixlib::Versioning.parse(desired_version)
Chef::Log.debug("The current chef-client version is #{cur_version} and the desired version is #{desired_version}")
new_resource.prevent_downgrade ? (des_version > cur_version) : (des_version != cur_version)
end