Update upstream cookbooks

This commit is contained in:
Greg Karékinian
2017-03-20 13:19:10 +00:00
parent bfd2d52ea8
commit bcfd44b923
340 changed files with 12576 additions and 5465 deletions

View File

@@ -1,94 +1,149 @@
v1.0.6
======
* Get rid of warnings about defined constant
* update Chef download url
* Updates supported versions
* require chef/rest
* use Chef::Mash explicitly
* Define the Chef::Mash constant if not provided by chef
* add test suites for ubuntu 14.04 and centos 7
# omnibus_updater Cookbook CHANGELOG
v1.0.4
======
* file_cache_path path to store chef-client
* Avoid deleting chef-server packages if using the same cache dir
* Only backup the last old chef client file
* make sure directory exists before trying to write to it
This file is used to list changes made in each version of the omnibus_updater cookbook.
v1.0.2
======
* Maintenance updates
* Support for Fedora
* omnitrucker solaris update
* bug fixes
## 3.0.2 (2017-03-07)
v1.0.0
======
* Breaking change: `:always_download` is now defaulted to false
* Add solaris package install support (#37 thanks @jtimberman)
* Update notifies/subscribes usage to support older Chefs (#38 thanks @spheromak)
- Fix version detection for macOS systems
- Test with Local Delivery instead of Rake
v0.2.8
======
* Always download the package (thanks @miketheman for swiftly pointing out the issue!)
## 3.0.1 (2017-01-05)
v0.2.6
======
* Work with amazon linux (thanks @thommay)
* Disable updates on debian 5 (thanks @ianand0204)
* Only use major version on debian systems (thanks @kvs)
* Allow prevention of downgrades (thanks @buysse)
* Add support for restarting chef service after upgrade (thanks @andrewfraley)
- Remove the remaining system gem reference
v0.2.4
======
* Only download omnibus package if version difference detected (#20 #22 #23)
* Provide attribute for always downloading package even if version matches
## 3.0.0 (2017-01-05)
v0.2.3
======
* Use chef internals for interactions with omnitruck to provide proper proxy support (#19)
- Added support for the new upgrade exit code (213) introduced with RFC062 and first shipped in chef 12.15.19
- Fix support for upgrading Windows client 12.6 and later by first moving the install directory
- Remove the recipe to cleanup system ruby chef installs. We should assume everyone is on Omnibus installs at this point and this same functionality can be easily implemented in your own recipes
- Added suse, opensuse, and opensuseleap to the metadata
v0.2.0
======
* Use omnitruck client for url generation for package fetching
* Use `prerelease` in favor of `allow_release_clients`
## 2.0.0 (2016-08-19)
v0.1.2
======
* Fix regression on debian package path construction (thanks [ashmere](https://github.com/ashmere))
- Hard fail on unsupported platforms now
- Add suse support
- Add additional chefspec tests
v0.1.1
======
* Search for proper version suffix if not provided (removes default '-1')
* Do not allow release clients by default when version search is enabled
* Push omnibus package installation to the end of run (reduces issue described in #10)
* Allow updater to be disabled via attribute (thanks [Teemu Matilainen](https://github.com/tmatilai))
## 1.2.1 (2016-08-19)
v0.1.0
======
* Fix redhat related versioning issues
* Remove requirement for '-1' suffix on versions
* Initial support for automatic latest version install
- Use the improved rakefile
- Fix github URLs in the metadata
- Add testing on additional platforms to kitchen config
- fix 1.2.0 no implicit conversion of nil to string. fixes #123
v0.0.5
======
* Add support for Ubuntu 12.10
* Path fixes for non-64 bit packages (thanks [ashmere](https://github.com/ashmere))
## 1.2.0 (2016-08-18)
v0.0.4
======
* Use new aws bucket by default
* Update file key building
- Add OS X DMG Support and fix Mac OS X Version Determination
- Add a potential Restart Fix
- Add chef_version metadata to the metadata.rb file
- Change maintainership to Chef and add standard Chef contributing, test, and maintainer docs
- Renamed the test recipe for consistency and removed the use of minitest
- Swapped Librarian for Berkshelf
- Added testing in Travis CI using ChefDK
- Resolved Foodcritic FC001/FC043 warnings
- Resolved all Cookstyle warnings
- Identify Fedora to be EL7 not EL6
- Avoid a node.set deprecation warning
- No need to warn on Debian 5\. No one should be on this now.
- Add a test for the standard flows
v0.0.3
======
* Path fix for debian omnibus packages (thanks [ashmere](https://github.com/ashmere))
# v1.1.0
v0.0.2
======
* Add robust check when uninstalling chef gem to prevent removal from omnibus
- Add Windows support (only Chef client versions 12.5.1 and below).
- Improve upgrade behavior on Amazon Linux
- Explicitly require windows testing gems in order to support test-kitchen 1.6.x.
v0.0.1
======
* Initial release
# v1.0.6
- Get rid of warnings about defined constant
- update Chef download url
- Updates supported versions
- require chef/rest
- use Chef::Mash explicitly
- Define the Chef::Mash constant if not provided by chef
- add test suites for ubuntu 14.04 and centos 7
# v1.0.4
- file_cache_path path to store chef-client
- Avoid deleting chef-server packages if using the same cache dir
- Only backup the last old chef client file
- make sure directory exists before trying to write to it
# v1.0.2
- Maintenance updates
- Support for Fedora
- omnitrucker solaris update
- bug fixes
# v1.0.0
- Breaking change: `:always_download` is now defaulted to false
- Add solaris package install support (#37 thanks @jtimberman)
- Update notifies/subscribes usage to support older Chefs (#38 thanks @spheromak)
# v0.2.8
- Always download the package (thanks @miketheman for swiftly pointing out the issue!)
# v0.2.6
- Work with amazon linux (thanks @thommay)
- Disable updates on debian 5 (thanks @ianand0204)
- Only use major version on debian systems (thanks @kvs)
- Allow prevention of downgrades (thanks @buysse)
- Add support for restarting chef service after upgrade (thanks @andrewfraley)
# v0.2.4
- Only download omnibus package if version difference detected (#20 #22 #23)
- Provide attribute for always downloading package even if version matches
# v0.2.3
- Use chef internals for interactions with omnitruck to provide proper proxy support (#19)
# v0.2.0
- Use omnitruck client for url generation for package fetching
- Use `prerelease` in favor of `allow_release_clients`
# v0.1.2
- Fix regression on debian package path construction (thanks [ashmere](https://github.com/ashmere))
# v0.1.1
- Search for proper version suffix if not provided (removes default '-1')
- Do not allow release clients by default when version search is enabled
- Push omnibus package installation to the end of run (reduces issue described in #10)
- Allow updater to be disabled via attribute (thanks [Teemu Matilainen](https://github.com/tmatilai))
# v0.1.0
- Fix redhat related versioning issues
- Remove requirement for '-1' suffix on versions
- Initial support for automatic latest version install
# v0.0.5
- Add support for Ubuntu 12.10
- Path fixes for non-64 bit packages (thanks [ashmere](https://github.com/ashmere))
# v0.0.4
- Use new aws bucket by default
- Update file key building
# v0.0.3
- Path fix for debian omnibus packages (thanks [ashmere](https://github.com/ashmere))
# v0.0.2
- Add robust check when uninstalling chef gem to prevent removal from omnibus
# v0.0.1
- Initial release

View File

@@ -0,0 +1 @@
Please refer to <https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD>

View File

@@ -0,0 +1,15 @@
<!-- This is a generated file. Please do not edit directly -->
# Maintainers
This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead.
# Project Maintainer
* [Tim Smith](https://github.com/tas50)
# Maintainers
* [Jennifer Davis](https://github.com/sigje)
* [Tim Smith](https://github.com/tas50)
* [Thom May](https://github.com/thommay)

View File

@@ -1,36 +1,37 @@
OmnibusUpdater
==============
# omnibus_updater cookbook
Update your omnibus! This cookbook can install the omnibus
Chef package into your system if you are currently running
via gem install, and it can keep your omnibus install up
to date.
[![Build Status](https://travis-ci.org/chef-cookbooks/omnibus_updater.svg?branch=master)](http://travis-ci.org/chef-cookbooks/omnibus_updater) [![Cookbook Version](https://img.shields.io/cookbook/v/omnibus_updater.svg)](https://supermarket.chef.io/cookbooks/omnibus_updater)
Supports
========
This cookbook allows you to upgrade the omnibus based Chef install package via Chef. You can run either latest or pin to specific version.
- redhat
- centos
- amazon
- scientific
- oracle
- debian
- ubuntu
- mac_os_x
- solaris
## Requirements
Usage
=====
### Platforms
Add the recipe to your run list and specify what version should
be installed on the node:
- Debian / Ubuntu
- Mac OS X
- RHEL (redhat, centos, amazon, scientific, oracle)
- Solaris
- SLES / openSUSE
- Windows
### Chef
- Chef 11+
### Cookbooks
- none
## Usage
Add the recipe to your run list and specify what version should be installed on the node:
`knife node run_list add recipe[omnibus_updater]`
In your role you'll likely want to set the version. It defaults
to nothing, and will install the latest..
In your role you'll likely want to set the version. It defaults to nothing, and will install the latest..
```
```ruby
override_attributes(
:omnibus_updater => {
:version => '11.4.0'
@@ -38,64 +39,63 @@ override_attributes(
)
```
It can also uninstall Chef from the system Ruby installation
if you tell it to:
## Features
```
override_attributes(
:omnibus_updater => {
:remove_chef_system_gem => true
}
)
### Latest Version
Force installation of the latest version regardless of value stored in version attribute by setting the `force_latest` attribute.
### Chef Killing
By default the omnibus updater will kill the chef instance by raising an exception. You can turn this off using the `kill_chef_on_upgrade` attribute. It is not recommended to turn this off. Internal chef libraries may change, move, or no longer exist. The currently running instance can encounter unexpected states because of this. To prevent this, the updater will attempt to kill the Chef instance so that it can be restarted in a normal state.
When `kill_chef_on_upgrade` is true Test-kitchen's converge stage will fail. To avoid this and attempt a second converge after the initial converge aborts, you can configure `.kitchen.yml` to retry a converge given a specific exit code from `node['omnibus_updater']['kill_chef_on_upgrade_exit_code']`. The second converge should pick up the new chef-client version and exit without error. The following is how to accomplish this:
```yaml
provisioner:
retry_on_exit_code:
- 213
max_retries: 1
wait_for_retry: 1
client_rb:
exit_status: :enabled
client_fork: false
```
Features
========
Exit code 213 is a special designation for Chef Client Upgrade and only exists in Chef Client >= 12.15.19\. If using an older client, you can replace exit code 213 (Chef upgrade) with 3 (SIGTERM recvd) as a workaround. Exit codes are documented here: <https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.md>
Latest Version
--------------
Force installation of the latest version regardless of value stored in version
attribute by setting the `force_latest` attribute.
Chef Killing
------------
By default the omnibus updater will kill the chef instance by raising an exception.
You can turn this off using the `kill_chef_on_upgrade` attribute. It is not
recommended to turn this off. Internal chef libraries may change, move, or no
longer exist. The currently running instance can encounter unexpected states because
of this. To prevent this, the updater will attempt to kill the Chef instance so
that it can be restarted in a normal state.
Restart chef-client Service
---------------------------
## Restart chef-client Service
Use the `restart_chef_service` attribute to restart chef-client if you have it running as a service.
Prerelease
--------
### Prerelease
Prereleases can be installed via the auto-installation using `prerelease` attribute.
Disable
-------
### Disable
If you want to disable the updater you can set the `disabled`
attribute to true. This might be useful if the cookbook is added
to a role but should then be skipped for example on a Chef server.
If you want to disable the updater you can set the `disabled` attribute to true. This might be useful if the cookbook is added to a role but should then be skipped for example on a Chef server.
Prevent Downgrade
-----------------
### Prevent Downgrade
If you want to prevent the updater from downgrading chef on a node, you
can set the `prevent_downgrade` attribute to true. This can be useful
for testing new versions manually. Note that the `always_download`
attribute takes precedence if set.
If you want to prevent the updater from downgrading chef on a node, you can set the `prevent_downgrade` attribute to true. This can be useful for testing new versions manually. Note that the `always_download` attribute takes precedence if set.
Infos
=====
## License & Authors
* Repo: https://github.com/hw-cookbooks/omnibus_updater
* IRC: Freenode @ #heavywater
* Cookbook: http://ckbk.it/omnibus_updater
- Author: Chris Roberts ([chrisroberts.code@gmail.com](mailto:chrisroberts.code@gmail.com))
```text
Copyright:: 2010-2016, Chef Software, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Attributes:: default
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,15 +17,16 @@
# limitations under the License.
#
default[:omnibus_updater][:version] = nil
default[:omnibus_updater][:force_latest] = false
default[:omnibus_updater][:cache_dir] = "#{Chef::Config[:file_cache_path]}/omnibus_updater"
default[:omnibus_updater][:cache_omnibus_installer] = false
default[:omnibus_updater][:remove_chef_system_gem] = false
default[:omnibus_updater][:prerelease] = false
default[:omnibus_updater][:disabled] = false
default[:omnibus_updater][:kill_chef_on_upgrade] = true
default[:omnibus_updater][:always_download] = false
default[:omnibus_updater][:prevent_downgrade] = false
default[:omnibus_updater][:restart_chef_service] = false
default[:omnibus_updater][:checksum] = nil
default['omnibus_updater']['version'] = nil
default['omnibus_updater']['force_latest'] = false
default['omnibus_updater']['cache_dir'] = "#{Chef::Config[:file_cache_path]}/omnibus_updater"
default['omnibus_updater']['cache_omnibus_installer'] = false
default['omnibus_updater']['prerelease'] = false
default['omnibus_updater']['disabled'] = false
default['omnibus_updater']['kill_chef_on_upgrade'] = true
default['omnibus_updater']['kill_chef_on_upgrade_exit_code'] = 213
default['omnibus_updater']['always_download'] = false
default['omnibus_updater']['prevent_downgrade'] = false
default['omnibus_updater']['restart_chef_service'] = false
default['omnibus_updater']['checksum'] = nil
default['omnibus_updater']['addlocal'] = 'ChefClientFeature,ChefServiceFeature' # Recommend adding ChefPSModuleFeature for clients 12.4.0 and up on windows platform.

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Library:: omnibuschecker
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,6 +25,6 @@ end
OmnibusChecker.send(:extend, OmnibusChecker)
unless(Chef::Recipe.instance_methods.include?(:is_omnibus?))
unless Chef::Recipe.instance_methods.include?(:is_omnibus?)
Chef::Recipe.send(:include, OmnibusChecker)
end

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Library:: omnitrucker
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,37 +17,33 @@
# limitations under the License.
#
require "chef/rest"
require "chef/mash"
require "net/http"
require 'chef/rest'
require 'chef/mash'
require 'net/http'
unless(Chef.constants.include?(:Mash))
Chef::Mash = Mash
end
Chef::Mash = Mash unless Chef.constants.include?(:Mash)
module OmnibusTrucker
class << self
URL_MAP = {
:p => :platform, :pv => :platform_version, :m => :machine,
:v => :version, :prerelease => :prerelease,
:nightlies => :nightlies
} unless defined?(URL_MAP)
p: :platform, pv: :platform_version, m: :machine,
v: :version, prerelease: :prerelease,
nightlies: :nightlies
}.freeze unless defined?(URL_MAP)
def build_url(*opts)
args = node = nil
opts.each do |o|
if(o.kind_of?(Hash))
if o.is_a?(Hash)
args = o
elsif(o.kind_of?(Chef::Node))
elsif o.is_a?(Chef::Node)
node = o
else
raise ArgumentError.new "Provided argument is not allowed: #{o.class}"
end
end
args ||= {}
if(node)
args = collect_attributes(node).merge(args)
end
args = collect_attributes(node).merge(args) if node
url = args[:url] || "http://www.chef.io/chef/download#{'-server' if args[:server]}"
u_args = URL_MAP.map do |u_k, a_k|
"#{u_k}=#{args[a_k]}" unless args[a_k].nil?
@@ -55,46 +51,52 @@ module OmnibusTrucker
"#{url}?#{u_args.join('&')}"
end
def collect_attributes(node, args={})
def collect_attributes(node, args = {})
set = Chef::Mash[
[:platform_family, :platform, :platform_version].map do |k|
%w(platform_family platform platform_version).map do |k|
[k, args[k] || node[k]]
end
]
unless(@attrs)
if(set[:platform] == 'amazon')
@attrs = {:platform => 'el', :platform_version => 6}
elsif(set[:platform_family] == 'fedora')
@attrs = {:platform => 'el', :platform_version => 6}
elsif(set[:platform_family] == 'rhel')
@attrs = {:platform => 'el', :platform_version => set[:platform_version].to_i}
elsif(set[:platform] == 'debian')
@attrs = {:platform => set[:platform], :platform_version => set[:platform_version].to_i}
elsif(set[:platform_family] == 'mac_os_x')
@attrs = {:platform => set[:platform_family], :platform_version => [set[:platform_version].to_f, 10.7].min}
unless @attrs
if set['platform'] == 'amazon'
@attrs = { platform: 'el', platform_version: 6 }
elsif set['platform_family'] == 'fedora'
@attrs = { platform: 'el', platform_version: 7 }
elsif set['platform_family'] == 'rhel'
@attrs = { platform: 'el', platform_version: set['platform_version'].to_i }
elsif set['platform'] == 'debian'
@attrs = { platform: set['platform'], platform_version: set['platform_version'].to_i }
elsif set['platform'] =~ /opensuse/
@attrs = { platform: 'suse', platform_version: 13 }
elsif set['platform_family'] == 'suse'
@attrs = { platform: 'sles', platform_version: 12 }
elsif set['platform_family'] == 'mac_os_x'
major, minor, _patch = set['platform_version'].split('.').map { |v| String(v) }
minor = [minor.to_i, 11].min # this is somewhat of a hack, we need to prevent this recipe to construct links for 10.12 for which there is no download yet...
@attrs = { platform: set['platform_family'], platform_version: [[major, minor].join('.'), '10.7'].max { |x, y| Gem::Version.new(x) <=> Gem::Version.new(y) } }
elsif set['platform_family'] == 'windows'
@attrs = { platform: set['platform'], platform_version: '2008r2' }
else
@attrs = {:platform => set[:platform], :platform_version => set[:platform_version]}
@attrs = { platform: set['platform'], platform_version: set['platform_version'] }
end
@attrs[:machine] = args[:machine] || node[:kernel][:machine]
@attrs[:machine] = "i386" if(set[:platform_family] == 'solaris2' && @attrs[:machine] == "i86pc")
@attrs[:machine] = args[:machine] || node['kernel']['machine']
@attrs[:machine] = 'i386' if set['platform_family'] == 'solaris2' && @attrs[:machine] == 'i86pc'
end
@attrs
end
def url(url_or_node, node = nil)
if(url_or_node.is_a?(Chef::Node))
if url_or_node.is_a?(Chef::Node)
url = build_url(url_or_node)
node = url_or_node
else
url = url_or_node
raise "Node instance is required for Omnitruck.url!" unless node
raise 'Node instance is required for Omnitruck.url!' unless node
end
Chef::Log.info("Using URL '#{url}' for chef-download") unless url.nil?
request = Chef::REST::RESTRequest.new(:head, URI.parse(url), nil)
result = request.call
if(result.kind_of?(Net::HTTPRedirection))
result['location']
end
result['location'] if result.is_a?(Net::HTTPRedirection)
end
end
end

View File

@@ -1,56 +1 @@
{
"name": "omnibus_updater",
"description": "Chef omnibus package updater and installer",
"long_description": "OmnibusUpdater\n==============\n\nUpdate your omnibus! This cookbook can install the omnibus\nChef package into your system if you are currently running\nvia gem install, and it can keep your omnibus install up\nto date.\n\nSupports\n========\n\n- redhat\n- centos\n- amazon\n- scientific\n- oracle\n- debian\n- ubuntu\n- mac_os_x\n- solaris\n\nUsage\n=====\n\nAdd the recipe to your run list and specify what version should\nbe installed on the node:\n\n`knife node run_list add recipe[omnibus_updater]`\n\nIn your role you'll likely want to set the version. It defaults\nto nothing, and will install the latest..\n\n```\noverride_attributes(\n :omnibus_updater => {\n :version => '11.4.0'\n }\n)\n```\n\nIt can also uninstall Chef from the system Ruby installation\nif you tell it to:\n\n```\noverride_attributes(\n :omnibus_updater => {\n :remove_chef_system_gem => true\n }\n)\n```\n\nFeatures\n========\n\nLatest Version\n--------------\n\nForce installation of the latest version regardless of value stored in version\nattribute by setting the `force_latest` attribute.\n\nChef Killing\n------------\n\nBy default the omnibus updater will kill the chef instance by raising an exception.\nYou can turn this off using the `kill_chef_on_upgrade` attribute. It is not\nrecommended to turn this off. Internal chef libraries may change, move, or no\nlonger exist. The currently running instance can encounter unexpected states because\nof this. To prevent this, the updater will attempt to kill the Chef instance so\nthat it can be restarted in a normal state.\n\nRestart chef-client Service\n---------------------------\n\nUse the `restart_chef_service` attribute to restart chef-client if you have it running as a service.\n\nPrerelease\n--------\n\nPrereleases can be installed via the auto-installation using `prerelease` attribute.\n\nDisable\n-------\n\nIf you want to disable the updater you can set the `disabled`\nattribute to true. This might be useful if the cookbook is added\nto a role but should then be skipped for example on a Chef server.\n\nPrevent Downgrade\n-----------------\n\nIf you want to prevent the updater from downgrading chef on a node, you \ncan set the `prevent_downgrade` attribute to true. This can be useful\nfor testing new versions manually. Note that the `always_download` \nattribute takes precedence if set.\n\nInfos\n=====\n\n* Repo: https://github.com/hw-cookbooks/omnibus_updater\n* IRC: Freenode @ #heavywater\n* Cookbook: http://ckbk.it/omnibus_updater\n",
"maintainer": "Chris Roberts",
"maintainer_email": "chrisroberts.code@gmail.com",
"license": "Apache 2.0",
"platforms": {
"redhat": ">= 0.0.0",
"centos": ">= 0.0.0",
"amazon": ">= 0.0.0",
"scientific": ">= 0.0.0",
"oracle": ">= 0.0.0",
"debian": ">= 0.0.0",
"ubuntu": ">= 0.0.0",
"mac_os_x": ">= 0.0.0",
"solaris": ">= 0.0.0"
},
"dependencies": {
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
},
"version": "1.0.6",
"source_url": "",
"issues_url": "",
"privacy": false,
"chef_versions": [
],
"ohai_versions": [
]
}
{"name":"omnibus_updater","version":"3.0.2","description":"Chef omnibus package updater and installer","long_description":"# omnibus_updater cookbook\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/omnibus_updater.svg?branch=master)](http://travis-ci.org/chef-cookbooks/omnibus_updater) [![Cookbook Version](https://img.shields.io/cookbook/v/omnibus_updater.svg)](https://supermarket.chef.io/cookbooks/omnibus_updater)\n\nThis cookbook allows you to upgrade the omnibus based Chef install package via Chef. You can run either latest or pin to specific version.\n\n## Requirements\n\n### Platforms\n\n- Debian / Ubuntu\n- Mac OS X\n- RHEL (redhat, centos, amazon, scientific, oracle)\n- Solaris\n- SLES / openSUSE\n- Windows\n\n### Chef\n\n- Chef 11+\n\n### Cookbooks\n\n- none\n\n## Usage\n\nAdd the recipe to your run list and specify what version should be installed on the node:\n\n`knife node run_list add recipe[omnibus_updater]`\n\nIn your role you'll likely want to set the version. It defaults to nothing, and will install the latest..\n\n```ruby\noverride_attributes(\n :omnibus_updater => {\n :version => '11.4.0'\n }\n)\n```\n\n## Features\n\n### Latest Version\n\nForce installation of the latest version regardless of value stored in version attribute by setting the `force_latest` attribute.\n\n### Chef Killing\n\nBy default the omnibus updater will kill the chef instance by raising an exception. You can turn this off using the `kill_chef_on_upgrade` attribute. It is not recommended to turn this off. Internal chef libraries may change, move, or no longer exist. The currently running instance can encounter unexpected states because of this. To prevent this, the updater will attempt to kill the Chef instance so that it can be restarted in a normal state.\n\nWhen `kill_chef_on_upgrade` is true Test-kitchen's converge stage will fail. To avoid this and attempt a second converge after the initial converge aborts, you can configure `.kitchen.yml` to retry a converge given a specific exit code from `node['omnibus_updater']['kill_chef_on_upgrade_exit_code']`. The second converge should pick up the new chef-client version and exit without error. The following is how to accomplish this:\n\n```yaml\nprovisioner:\n retry_on_exit_code:\n - 213\n max_retries: 1\n wait_for_retry: 1\n client_rb:\n exit_status: :enabled\n client_fork: false\n```\n\nExit code 213 is a special designation for Chef Client Upgrade and only exists in Chef Client >= 12.15.19\\. If using an older client, you can replace exit code 213 (Chef upgrade) with 3 (SIGTERM recvd) as a workaround. Exit codes are documented here: <https://github.com/chef/chef-rfc/blob/master/rfc062-exit-status.md>\n\n## Restart chef-client Service\n\nUse the `restart_chef_service` attribute to restart chef-client if you have it running as a service.\n\n### Prerelease\n\nPrereleases can be installed via the auto-installation using `prerelease` attribute.\n\n### Disable\n\nIf you want to disable the updater you can set the `disabled` attribute to true. This might be useful if the cookbook is added to a role but should then be skipped for example on a Chef server.\n\n### Prevent Downgrade\n\nIf you want to prevent the updater from downgrading chef on a node, you can set the `prevent_downgrade` attribute to true. This can be useful for testing new versions manually. Note that the `always_download` attribute takes precedence if set.\n\n## License & Authors\n\n- Author: Chris Roberts ([chrisroberts.code@gmail.com](mailto:chrisroberts.code@gmail.com))\n\n```text\nCopyright:: 2010-2016, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","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"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{}}

View File

@@ -1,11 +0,0 @@
name "omnibus_updater"
maintainer "Chris Roberts"
maintainer_email "chrisroberts.code@gmail.com"
license "Apache 2.0"
description "Chef omnibus package updater and installer"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.0.6"
%w(redhat centos amazon scientific oracle debian ubuntu mac_os_x solaris).each do |plat|
supports plat
end

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Recipe:: default
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,17 +17,15 @@
# limitations under the License.
#
if(node[:omnibus_updater][:disabled])
# fail hard if we're on an unsupported platform
# feel free to open PRs to add additional platforms
unless platform_family?('debian', 'fedora', 'mac_os_x', 'rhel', 'solaris2', 'windows', 'suse')
Chef::Application.fatal! "Omnibus updater does not support the #{node['platform']} platform"
end
if node['omnibus_updater']['disabled']
Chef::Log.warn 'Omnibus updater disabled via `disabled` attribute'
elsif(node[:platform] == 'debian' && Gem::Version.new(node[:platform_version]) < Gem::Version.new('6.0.0'))
Chef::Log.warn 'Omnibus updater does not support Debian 5'
elsif(node[:platform] == 'raspbian')
Chef::Log.warn 'Omnibus updater does not support Raspbian'
else
include_recipe 'omnibus_updater::downloader'
include_recipe 'omnibus_updater::installer'
end
if(node[:omnibus_updater][:remove_chef_system_gem])
include_recipe 'omnibus_updater::remove_chef_system_gem'
end

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Recipe:: downloader
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,42 +20,48 @@
# NOTE: This recipe is here for others that just want the
# package, not the actual installation (lxc for example)
if(node[:omnibus_updater][:direct_url])
remote_path = node[:omnibus_updater][:direct_url]
if node['omnibus_updater']['direct_url']
remote_path = node['omnibus_updater']['direct_url']
else
version = node[:omnibus_updater][:version] || ''
version = node['omnibus_updater']['version'] || ''
remote_path = OmnibusTrucker.url(
OmnibusTrucker.build_url(node,
:version => node[:omnibus_updater][:force_latest] ? nil : version.sub(/\-.+$/, ''),
:prerelease => node[:omnibus_updater][:preview]
), node
version: node['omnibus_updater']['force_latest'] ? nil : version.sub(/\-.+$/, ''),
prerelease: node['omnibus_updater']['preview']
), node
)
raise 'Could not construct URL for chef-download' if remote_path.nil?
end
if(remote_path)
node.set[:omnibus_updater][:full_url] = remote_path
if remote_path
node.normal['omnibus_updater']['full_url'] = remote_path
directory node[:omnibus_updater][:cache_dir] do
directory node['omnibus_updater']['cache_dir'] do
recursive true
end
remote_file "omnibus_remote[#{File.basename(remote_path)}]" do
path File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))
path File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))
source remote_path
backup false
checksum node[:omnibus_updater][:checksum] if node[:omnibus_updater][:checksum]
checksum node['omnibus_updater']['checksum'] if node['omnibus_updater']['checksum']
action :create_if_missing
only_if do
unless(version = node[:omnibus_updater][:version])
version = node[:omnibus_updater][:full_url].scan(%r{chef[_-](\d+\.\d+.\d+)}).flatten.first
unless (version = node['omnibus_updater']['version'])
version = case node['platform_family']
when 'windows'
node['omnibus_updater']['full_url'].scan(/chef-windows|client-(\d+\.\d+.\d+)/).flatten.first
else
node['omnibus_updater']['full_url'].scan(/chef[_-](\d+\.\d+.\d+)/).flatten.first
end
end
if(node[:omnibus_updater][:always_download])
if node['omnibus_updater']['always_download']
# warn if there may be unexpected behavior
node[:omnibus_updater][:prevent_downgrade] &&
Chef::Log.warn("omnibus_updater: prevent_downgrade is ignored when always_download is true")
node['omnibus_updater']['prevent_downgrade'] &&
Chef::Log.warn('omnibus_updater: prevent_downgrade is ignored when always_download is true')
Chef::Log.debug "Omnibus Updater remote path: #{remote_path}"
true
elsif(node[:omnibus_updater][:prevent_downgrade])
elsif node['omnibus_updater']['prevent_downgrade']
# Return true if the found/specified version is newer
Gem::Version.new(version.to_s.sub(/\-.+$/, '')) > Gem::Version.new(Chef::VERSION)
else

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Recipe:: installer
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,53 +18,107 @@
#
include_recipe 'omnibus_updater'
remote_path = node[:omnibus_updater][:full_url].to_s
remote_path = node['omnibus_updater']['full_url']
file '/tmp/nocheck' do
content 'conflict=nocheck\naction=nocheck'
only_if { node['os'] =~ /^solaris/ }
end
service 'chef-client' do
service 'chef-client-omnibus' do
service_name 'chef-client'
supports status: true, restart: true
action :nothing
end
ruby_block 'omnibus chef killer' do
block do
raise 'New omnibus chef version installed. Killing Chef run!'
end
action :nothing
only_if do
node[:omnibus_updater][:kill_chef_on_upgrade]
end
end
if platform?('windows')
version = node['omnibus_updater']['version'] || remote_path.scan(/chef-windows|client-(\d+\.\d+.\d+)/).flatten.first
Chef::Recipe.send(:include, Chef::Mixin::ShellOut)
chef_version = shell_out('chef-client -v')
chef_version = chef_version.stdout
execute "omnibus_install[#{File.basename(remote_path)}]" do
case File.extname(remote_path)
when '.deb'
command "dpkg -i #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))}"
when '.rpm'
command "rpm -Uvh --oldpackage #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))}"
when '.sh'
command "/bin/sh #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))}"
when '.solaris'
command "pkgadd -n -d #{File.join(node[:omnibus_updater][:cache_dir], File.basename(remote_path))} -a /tmp/nocheck chef"
else
raise "Unknown package type encountered for install: #{File.extname(remote_path)}"
# clean up previous upgrades
directory 'c:/opscode/chef.upgrade' do
action :delete
recursive true
end
action :nothing
if(node[:omnibus_updater][:restart_chef_service])
notifies :restart, resources(:service => 'chef-client'), :immediately
end
notifies :create, resources(:ruby_block => 'omnibus chef killer'), :immediately
end
ruby_block 'Omnibus Chef install notifier' do
block{ true }
action :nothing
subscribes :create, resources(:remote_file => "omnibus_remote[#{File.basename(remote_path)}]"), :immediately
notifies :run, resources(:execute => "omnibus_install[#{File.basename(remote_path)}]"), :delayed
only_if { node['chef_packages']['chef']['version'] != node['omnibus_updater']['version'] }
if node['chef_packages']['chef']['version'] != node['omnibus_updater']['version']
execute 'chef-move' do
command 'move c:/opscode/chef c:/opscode/chef.upgrade'
action :nothing
end
execute 'chef-uninstall' do
command 'wmic product where "name like \'Chef Client%% %%\'" call uninstall /nointeractive'
action :nothing
end
execute 'chef-install' do
command "msiexec.exe /qn /i #{File.basename(remote_path)} ADDLOCAL=\"#{node['omnibus_updater']['addlocal']}\""
cwd node['omnibus_updater']['cache_dir']
action :nothing
end
execute 'chef-service-kill' do
command 'taskkill /F /FI "SERVICES eq chef-client"'
action :nothing
end
ruby_block 'Omnibus Chef Update' do
block { true }
notifies :run, 'execute[chef-service-kill]', :immediately
notifies :run, 'execute[chef-move]', :immediately
notifies :run, 'execute[chef-uninstall]', :immediately
notifies :run, 'execute[chef-install]', :immediately
notifies :start, 'service[chef-client-omnibus]', :immediately if node['omnibus_updater']['restart_chef_service']
not_if { chef_version == "Chef: #{version}\r\n" }
end
end
else
file '/tmp/nocheck' do
content 'conflict=nocheck\naction=nocheck'
only_if { node['os'] =~ /^solaris/ }
end
ruby_block 'omnibus chef killer' do
block do
Chef::Application.fatal!('New omnibus chef version installed. Killing Chef run!', node['omnibus_updater']['kill_chef_on_upgrade_exit_code'])
end
action :nothing
only_if { node['omnibus_updater']['kill_chef_on_upgrade'] }
end
execute "omnibus_install[#{File.basename(remote_path)}]" do # ~FC009
case File.extname(remote_path)
when '.deb'
command "dpkg -i #{File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))}"
when '.rpm'
if node['platform'] == 'amazon'
command "rpm -e chef && rpm -Uvh --oldpackage #{File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))}"
else
command "rpm -Uvh --oldpackage #{File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))}"
end
when '.sh'
command "/bin/sh #{File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))}"
when '.solaris'
command "pkgadd -n -d #{File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))} -a /tmp/nocheck chef"
when '.dmg'
command <<-EOF
hdiutil detach "/Volumes/chef_software" >/dev/null 2>&1 || true
hdiutil attach "#{File.join(node['omnibus_updater']['cache_dir'], File.basename(remote_path))}" -mountpoint "/Volumes/chef_software"
cd / && /usr/sbin/installer -pkg `find "/Volumes/chef_software" -name \*.pkg` -target /
hdiutil detach "/Volumes/chef_software"
EOF
else
raise "Unknown package type encountered for install: #{File.extname(remote_path)}"
end
action :nothing
if node['omnibus_updater']['restart_chef_service']
notifies :restart, 'service[chef-client-omnibus]', :immediately
end
notifies :create, 'ruby_block[omnibus chef killer]', :immediately
end
ruby_block 'Omnibus Chef install notifier' do
block { true }
action :nothing
subscribes :create, "remote_file[omnibus_remote[#{File.basename(remote_path)}]]", :immediately
notifies :run, "execute[omnibus_install[#{File.basename(remote_path)}]]", :delayed
only_if { node['chef_packages']['chef']['version'] != node['omnibus_updater']['version'] }
end
end
include_recipe 'omnibus_updater::old_package_cleaner'

View File

@@ -1,8 +1,8 @@
#
# Cookbook Name:: omnibus_updater
# Cookbook:: omnibus_updater
# Recipe:: old_package_cleaner
#
# Copyright 2014, Heavy Water Ops, LLC
# Copyright:: 2014-2017, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,9 +18,9 @@
#
old_pkgs =
if(::File.exist?(node[:omnibus_updater][:cache_dir]))
Dir.glob(File.join(node[:omnibus_updater][:cache_dir], 'chef_*')).find_all do |file|
!file.include?(node[:omnibus_updater][:version].to_s) && !file.scan(/\.(rpm|deb)$/).empty?
if ::File.exist?(node['omnibus_updater']['cache_dir'])
Dir.glob(File.join(node['omnibus_updater']['cache_dir'], 'chef*')).find_all do |file|
!file.include?(node['omnibus_updater']['version'].to_s) && !file.scan(/\.(rpm|deb|msi|dmg)$/).empty?
end
else
[]

View File

@@ -1,29 +0,0 @@
#
# Cookbook Name:: omnibus_updater
# Recipe:: remove_chef_system_gem
#
# Copyright 2014, Heavy Water Ops, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
gem_package 'chef' do
action :purge
only_if do
Chef::Provider::Package::Rubygems.new(
Chef::Resource::GemPackage.new('dummy_package')
).gem_env.gem_paths.detect{|path|
path.start_with?('/opt/omnibus') || path.start_with?('/opt/chef')
}.nil? && node[:omnibus_updater][:remove_chef_system_gem]
end
end