Update users cookbook and poise cookbooks

The poise cookbooks were incompatible with Chef 13
This commit is contained in:
Greg Karékinian 2017-06-16 15:50:13 +02:00
parent f93070c4c0
commit ff3d062c73
65 changed files with 238 additions and 130 deletions

6
Batali
View File

@ -20,7 +20,11 @@ Batali.define do
cookbook 'application_javascript', '~> 1.0.0' cookbook 'application_javascript', '~> 1.0.0'
cookbook 'application_ruby', '~> 4.1.0' cookbook 'application_ruby', '~> 4.1.0'
cookbook 'application_git', '~> 1.1.0' # 1.2.0 doesn't work with knife-solo cookbook 'application_git', '~> 1.1.0' # 1.2.0 doesn't work with knife-solo
cookbook 'users', '~> 5.0.0' cookbook 'poise', '~> 2.8.1'
cookbook 'poise-languages', '~> 2.1.1'
cookbook 'poise-ruby', '~> 2.3.0'
cookbook 'poise-javascript', '~> 1.2.0'
cookbook 'users', '~> 5.1.0'
cookbook 'sudo', '~> 3.5.0' cookbook 'sudo', '~> 3.5.0'
cookbook 'hostname', '~> 0.4.2' cookbook 'hostname', '~> 0.4.2'
cookbook 'firewall', '~> 2.6.2' cookbook 'firewall', '~> 2.6.2'

View File

@ -574,18 +574,6 @@
"version": "1.1.0" "version": "1.1.0"
} }
}, },
{
"name": "poise",
"dependencies": [
],
"version": "2.7.2",
"source": {
"type": "Batali::Source::Site",
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise/versions/2.7.2/download",
"version": "2.7.2"
}
},
{ {
"name": "poise-build-essential", "name": "poise-build-essential",
"dependencies": [ "dependencies": [
@ -632,11 +620,11 @@
"~> 1.0" "~> 1.0"
] ]
], ],
"version": "2.1.0", "version": "2.1.1",
"source": { "source": {
"type": "Batali::Source::Site", "type": "Batali::Source::Site",
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-languages/versions/2.1.0/download", "url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-languages/versions/2.1.1/download",
"version": "2.1.0" "version": "2.1.1"
} }
}, },
{ {
@ -666,11 +654,11 @@
"~> 2.0" "~> 2.0"
] ]
], ],
"version": "2.2.0", "version": "2.3.0",
"source": { "source": {
"type": "Batali::Source::Site", "type": "Batali::Source::Site",
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-ruby/versions/2.2.0/download", "url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-ruby/versions/2.3.0/download",
"version": "2.2.0" "version": "2.3.0"
} }
}, },
{ {
@ -746,11 +734,11 @@
"~> 2.0" "~> 2.0"
] ]
], ],
"version": "1.1.0", "version": "1.2.0",
"source": { "source": {
"type": "Batali::Source::Site", "type": "Batali::Source::Site",
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-javascript/versions/1.1.0/download", "url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-javascript/versions/1.2.0/download",
"version": "1.1.0" "version": "1.2.0"
} }
}, },
{ {
@ -838,16 +826,28 @@
"version": "4.0.0" "version": "4.0.0"
} }
}, },
{
"name": "poise",
"dependencies": [
],
"version": "2.8.1",
"source": {
"type": "Batali::Source::Site",
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise/versions/2.8.1/download",
"version": "2.8.1"
}
},
{ {
"name": "users", "name": "users",
"dependencies": [ "dependencies": [
], ],
"version": "5.0.0", "version": "5.1.0",
"source": { "source": {
"type": "Batali::Source::Site", "type": "Batali::Source::Site",
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/users/versions/5.0.0/download", "url": "https://supermarket.chef.io:443/api/v1/cookbooks/users/versions/5.1.0/download",
"version": "5.0.0" "version": "5.1.0"
} }
}, },
{ {

View File

@ -1,5 +1,10 @@
# Poise-Javascript Changelog # Poise-Javascript Changelog
## v1.2.0
* Updated Node.js versions. The default version is now the Boron LTS series.
* Chef 13 support.
## v1.1.0 ## v1.1.0
* New version list for Node.js. * New version list for Node.js.

View File

@ -317,7 +317,7 @@ The Poise test server infrastructure is sponsored by [Rackspace](https://rackspa
## License ## License
Copyright 2015-2016, Noah Kantrowitz Copyright 2015-2017, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ module PoiseJavascript
provides(:nodejs) provides(:nodejs)
include PoiseLanguages::Static( include PoiseLanguages::Static(
# 4.x is still first here because that is what NodeJS recommends. # 4.x is still first here because that is what NodeJS recommends.
versions: %w{4.5.0 6.4.0 6.3.1 6.2.2 6.1.0 6.0.0 5.11.0 5.10.1 5.9.1 5.8.0 5.7.1 5.6.0 5.5.0 5.4.1 5.3.0 5.2.0 5.1.1 5.0.0 4.4.3 4.3.2 4.2.6 4.1.1 4.0.0 0.12.7 0.11.16 0.10.40 0.9.12 0.8.28 0.7.12 0.6.21 0.5.10}, versions: %w{6.10.2 7.9.0 7.8.0 7.7.4 7.6.0 7.5.0 7.4.0 7.3.0 7.2.1 7.1.0 7.0.0 6.9.5 6.8.1 6.7.0 6.6.0 6.5.0 6.4.0 6.3.1 6.2.2 6.0.0 5.12.0 5.11.1 5.10.1 5.9.1 5.8.0 5.7.1 5.6.0 5.5.0 5.4.1 5.3.0 5.2.0 5.0.0 4.8.2 4.7.3 4.6.2 4.5.0 4.4.7 4.3.2 4.2.6 4.1.2 4.0.0 0.12.18 0.11.16 0.10.48 0.9.12 0.8.28 0.7.12 0.6.21 0.5.10 0.4.12 0.3.8 0.2.6},
machines: %w{linux-i686 linux-x86_64 linux-armv6l linux-armv7l linux-arm64 darwin-x86_64}, machines: %w{linux-i686 linux-x86_64 linux-armv6l linux-armv7l linux-arm64 darwin-x86_64},
url: 'https://nodejs.org/dist/v%{version}/node-v%{version}-%{kernel}-%{machine}.tar.gz', url: 'https://nodejs.org/dist/v%{version}/node-v%{version}-%{kernel}-%{machine}.tar.gz',
) )

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -16,5 +16,5 @@
module PoiseJavascript module PoiseJavascript
VERSION = '1.1.0' VERSION = '1.2.0'
end end

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,10 @@
# Changelog # Changelog
## v2.1.1
* Fix the SCL repository enable command for RHEL.
* Internal refactoring of the system package installer.
## v2.1.0 ## v2.1.0
* Allow customizing properties on the system package install resource via a block * Allow customizing properties on the system package install resource via a block

View File

@ -108,7 +108,7 @@ module PoiseLanguages
# KNOW BY FILING A GITHUB ISSUE AT http://github.com/poise/poise-languages/issues/new. # KNOW BY FILING A GITHUB ISSUE AT http://github.com/poise/poise-languages/issues/new.
repo_name = "rhel-server-rhscl-#{node['platform_version'][0]}-rpms" repo_name = "rhel-server-rhscl-#{node['platform_version'][0]}-rpms"
execute "subscription-manager repos --enable #{repo_name}" do execute "subscription-manager repos --enable #{repo_name}" do
not_if { shell_out!('subscription-manager repos --list').stdout.include?(repo_name) } not_if { shell_out!('subscription-manager repos --list-enabled').stdout.include?(repo_name) }
end end
else else
package 'centos-release-scl-rh' do package 'centos-release-scl-rh' do

View File

@ -97,60 +97,86 @@ module PoiseLanguages
# #
# @return [void] # @return [void]
def action_install def action_install
run_package_action(:install) notifying_block do
install_packages
run_action_hack
end
end end
# The `upgrade` action for the `poise_languages_system` resource. # The `upgrade` action for the `poise_languages_system` resource.
# #
# @return [void] # @return [void]
def action_upgrade def action_upgrade
run_package_action(:upgrade) notifying_block do
upgrade_packages
run_action_hack
end
end end
# The `uninstall` action for the `poise_languages_system` resource. # The `uninstall` action for the `poise_languages_system` resource.
# #
# @return [void] # @return [void]
def action_uninstall def action_uninstall
action = node.platform_family?('debian') ? :purge : :remove notifying_block do
package_resources(action).each do |resource| uninstall_packages
resource.run_action(action)
new_resource.updated_by_last_action(true) if resource.updated_by_last_action?
end end
end end
private private
# Create package resource objects for all needed packages. These are created # Install the needed language packages.
# directly and not added to the resource collection.
# #
# @return [Array<Chef::Resource::Package>] # @api private
def package_resources(action) # @return [Array<Chef::Resource>]
def install_packages
packages = {new_resource.package_name => new_resource.package_version} packages = {new_resource.package_name => new_resource.package_version}
# If we are supposed to install the dev package, grab it using the same # If we are supposed to install the dev package, grab it using the same
# version as the main package. # version as the main package.
if new_resource.dev_package if new_resource.dev_package
packages[new_resource.dev_package] = new_resource.package_version packages[new_resource.dev_package] = new_resource.package_version
end end
Chef::Log.debug("[#{new_resource.parent}] Building package resource using #{packages.inspect}.") Chef::Log.debug("[#{new_resource.parent}] Building package resource using #{packages.inspect}.")
# Check for multi-package support.
package_resource_class = Chef::Resource.resource_for_node(:package, node) package_resource_class = Chef::Resource.resource_for_node(:package, node)
@package_resource ||= if node.platform_family?('rhel', 'fedora', 'amazon', 'mac_os_x') package_provider_class = package_resource_class.new('multipackage_check', run_context).provider_for_action(:install)
# @todo Can't use multi-package mode with yum pending https://github.com/chef/chef/issues/3476. package_resources = if package_provider_class.respond_to?(:use_multipackage_api?) && package_provider_class.use_multipackage_api?
packages.map do |name, version| package packages.keys do
package_resource_class.new(name, run_context).tap do |r| version packages.values
r.version(version)
r.action(action)
r.declared_type = :package
r.retries(5)
end
end end
else else
[package_resource_class.new(packages.keys, run_context).tap do |r| # Fallback for non-multipackage.
r.version(packages.values) packages.map do |pkg_name, pkg_version|
r.action(action) package pkg_name do
r.declared_type = :package version pkg_version
r.retries(5) end
end] end
end
# Apply some settings to all of the resources.
Array(package_resources).each do |res|
res.retries(5)
res.define_singleton_method(:apply_action_hack?) { true }
end
end
# Upgrade the needed language packages.
#
# @api private
# @return [Array<Chef::Resource>]
def upgrade_packages
install_packages.each do |res|
res.action(:upgrade)
end
end
# Uninstall the needed language packages.
#
# @api private
# @return [Array<Chef::Resource>]
def uninstall_packages
install_packages.each do |res|
res.action(node.platform_family?('debian') ? :purge : :remove)
end end
end end
@ -161,21 +187,34 @@ module PoiseLanguages
# #
# @param action [Symbol] Action to run on all package resources. # @param action [Symbol] Action to run on all package resources.
# @return [void] # @return [void]
def run_package_action(action) def run_action_hack
package_resources(action).each do |resource| # If new_resource.package_version is set, skip this madness.
# Reset it so we have a clean baseline. return if new_resource.package_version
resource.updated_by_last_action(false)
# Grab the provider. # Process every resource in the current collection, which is bounded
provider = resource.provider_for_action(action) # by notifying_block.
provider.action = action run_context.resource_collection.each do |resource|
# Check the candidate version if needed. With a manual package_version # Only apply to things we tagged above.
# you get whatever you asked for. next unless resource.respond_to?(:apply_action_hack?) && resource.apply_action_hack?
patch_load_current_resource!(provider, new_resource.version) unless new_resource.package_version
# Run our action. Array(resource.action).each do |action|
Chef::Log.debug("[#{new_resource.parent}] Running #{provider} with #{action}") # Reset it so we have a clean baseline.
provider.run_action(action) resource.updated_by_last_action(false)
# Check updated flag. # Grab the provider.
new_resource.updated_by_last_action(true) if resource.updated_by_last_action? provider = resource.provider_for_action(action)
provider.action = action
# Inject our check for the candidate version. This will actually
# get run during run_action below.
patch_load_current_resource!(provider, new_resource.version)
# Run our action.
Chef::Log.debug("[#{new_resource.parent}] Running #{provider} with #{action}")
provider.run_action(action)
# Check updated flag.
new_resource.updated_by_last_action(true) if resource.updated_by_last_action?
end
# Make sure the resource doesn't run again when notifying_block ends.
resource.action(:nothing)
end end
end end

View File

@ -16,5 +16,5 @@
module PoiseLanguages module PoiseLanguages
VERSION = '2.1.0' VERSION = '2.1.1'
end end

View File

@ -1 +1 @@
{"name":"poise-languages","version":"2.1.0","description":"A Chef cookbook to help writing language cookbooks.","long_description":"# Poise-Languages Cookbook\n\n[![Build Status](https://img.shields.io/travis/poise/poise-languages.svg)](https://travis-ci.org/poise/poise-languages)\n[![Gem Version](https://img.shields.io/gem/v/poise-languages.svg)](https://rubygems.org/gems/poise-languages)\n[![Cookbook Version](https://img.shields.io/cookbook/v/poise-languages.svg)](https://supermarket.chef.io/cookbooks/poise-languages)\n[![Coverage](https://img.shields.io/codecov/c/github/poise/poise-languages.svg)](https://codecov.io/github/poise/poise-languages)\n[![Gemnasium](https://img.shields.io/gemnasium/poise/poise-languages.svg)](https://gemnasium.com/poise/poise-languages)\n[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\nShared support code for Poise's language cookbooks like poise-ruby and\npoise-python.\n\n## License\n\nCopyright 2015-2017, Noah Kantrowitz\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\nhttp://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","maintainer":"Noah Kantrowitz","maintainer_email":"noah@coderanger.net","license":"Apache 2.0","platforms":{},"dependencies":{"poise":"~> 2.5","poise-archive":"~> 1.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/poise/poise-languages","issues_url":"https://github.com/poise/poise-languages/issues","chef_version":[["< 14",">= 12.1"],[]],"ohai_version":[[]]} {"name":"poise-languages","version":"2.1.1","description":"A Chef cookbook to help writing language cookbooks.","long_description":"# Poise-Languages Cookbook\n\n[![Build Status](https://img.shields.io/travis/poise/poise-languages.svg)](https://travis-ci.org/poise/poise-languages)\n[![Gem Version](https://img.shields.io/gem/v/poise-languages.svg)](https://rubygems.org/gems/poise-languages)\n[![Cookbook Version](https://img.shields.io/cookbook/v/poise-languages.svg)](https://supermarket.chef.io/cookbooks/poise-languages)\n[![Coverage](https://img.shields.io/codecov/c/github/poise/poise-languages.svg)](https://codecov.io/github/poise/poise-languages)\n[![Gemnasium](https://img.shields.io/gemnasium/poise/poise-languages.svg)](https://gemnasium.com/poise/poise-languages)\n[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\nShared support code for Poise's language cookbooks like poise-ruby and\npoise-python.\n\n## License\n\nCopyright 2015-2017, Noah Kantrowitz\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\nhttp://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","maintainer":"Noah Kantrowitz","maintainer_email":"noah@coderanger.net","license":"Apache-2.0","platforms":{"aix":">= 0.0.0","amazon":">= 0.0.0","arch":">= 0.0.0","centos":">= 0.0.0","chefspec":">= 0.0.0","debian":">= 0.0.0","dragonfly4":">= 0.0.0","fedora":">= 0.0.0","freebsd":">= 0.0.0","gentoo":">= 0.0.0","ios_xr":">= 0.0.0","mac_os_x":">= 0.0.0","nexus":">= 0.0.0","omnios":">= 0.0.0","openbsd":">= 0.0.0","opensuse":">= 0.0.0","oracle":">= 0.0.0","raspbian":">= 0.0.0","redhat":">= 0.0.0","slackware":">= 0.0.0","smartos":">= 0.0.0","solaris2":">= 0.0.0","suse":">= 0.0.0","ubuntu":">= 0.0.0","windows":">= 0.0.0"},"dependencies":{"poise":"~> 2.5","poise-archive":"~> 1.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/poise/poise-languages","issues_url":"https://github.com/poise/poise-languages/issues","chef_version":[["< 14",">= 12.1"]],"ohai_version":[]}

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## v2.3.0
* Chef 13 support.
## v2.2.0 ## v2.2.0
* Add support for Ubuntu 16.04 system packages. * Add support for Ubuntu 16.04 system packages.

View File

@ -290,7 +290,7 @@ The Poise test server infrastructure is sponsored by [Rackspace](https://rackspa
## License ## License
Copyright 2015-2016, Noah Kantrowitz Copyright 2015-2017, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -128,7 +128,7 @@ module PoiseRuby
# #
# @return [String] # @return [String]
def bundler_binary def bundler_binary
@bundler_binary ||= ::File.join(gem_bindir, 'bundle') @bundler_binary ||= ::File.join(poise_gem_bindir, 'bundle')
end end
# Find the absolute path to the Gemfile. This mirrors bundler's internal # Find the absolute path to the Gemfile. This mirrors bundler's internal
@ -168,8 +168,12 @@ module PoiseRuby
# the required configuration on the resource combined with gem having # the required configuration on the resource combined with gem having
# terrible output formats. # terrible output formats.
# #
# Renamed from #gem_bindir in 2.3.0 because of a conflict with a method
# of the same name in Chef::Mixin::PathSanity (which is pulled in via
# ShellOut) added in 13.0.
#
# @return [String] # @return [String]
def gem_bindir def poise_gem_bindir
cmd = ruby_shell_out!(new_resource.gem_binary, 'environment') cmd = ruby_shell_out!(new_resource.gem_binary, 'environment')
# Parse a line like: # Parse a line like:
# - EXECUTABLE DIRECTORY: /usr/local/bin # - EXECUTABLE DIRECTORY: /usr/local/bin

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -16,5 +16,5 @@
module PoiseRuby module PoiseRuby
VERSION = '2.2.0' VERSION = '2.3.0'
end end

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
# #
# Copyright 2015-2016, Noah Kantrowitz # Copyright 2015-2017, Noah Kantrowitz
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

View File

@ -1,5 +1,16 @@
# Changelog # Changelog
## v2.8.1
* Fix a missing `require` when using `subclass_providers!` on Chef 12.3.
## v2.8.0
* Chef 13 compatibility.
* Passing a symbol for the parent now works with the `include Poise(:name)`
shortcut.
* Fixed `subclass_providers!` on older versions of Chef.
## v2.7.2 ## v2.7.2
* Test harness fixes for Chef. * Test harness fixes for Chef.

View File

@ -69,7 +69,7 @@ end
# include Poise(container: true) # include Poise(container: true)
def Poise(options={}) def Poise(options={})
# Allow passing a class as a shortcut # Allow passing a class as a shortcut
if options.is_a?(Class) if options.is_a?(Class) || options.is_a?(Symbol)
options = {parent: options} options = {parent: options}
end end

View File

@ -99,6 +99,8 @@ module Poise
raise Poise::Error.new("Parser must be a Proc or Symbol: #{parser.inspect}") if parser && !(parser.is_a?(Proc) || parser.is_a?(Symbol)) raise Poise::Error.new("Parser must be a Proc or Symbol: #{parser.inspect}") if parser && !(parser.is_a?(Proc) || parser.is_a?(Symbol))
# Cast to a set at definition time. # Cast to a set at definition time.
forced_keys = Set.new(forced_keys) unless forced_keys.is_a?(Set) forced_keys = Set.new(forced_keys) unless forced_keys.is_a?(Set)
# Never allow name to be called accidentally since it does really wonky things.
forced_keys.add(:name)
# Unlike LWRPBase.attribute, I don't care about Ruby 1.8. Worlds tiniest violin. # Unlike LWRPBase.attribute, I don't care about Ruby 1.8. Worlds tiniest violin.
define_method(name.to_sym) do |arg=nil, &block| define_method(name.to_sym) do |arg=nil, &block|
iv_sym = :"@#{name}" iv_sym = :"@#{name}"

View File

@ -14,6 +14,12 @@
# limitations under the License. # limitations under the License.
# #
begin
require 'chef/chef_class'
rescue LoadError
# This space left intentionally blank, fallback is below.
end
require 'poise/error' require 'poise/error'
require 'poise/helpers/resource_name' require 'poise/helpers/resource_name'
@ -39,7 +45,12 @@ module Poise
# Deal with the node maps. # Deal with the node maps.
node_maps = {} node_maps = {}
node_maps['handler map'] = Chef.provider_handler_map if defined?(Chef.provider_handler_map) node_maps['handler map'] = Chef.provider_handler_map if defined?(Chef.provider_handler_map)
node_maps['priority map'] = Chef.provider_priority_map if defined?(Chef.provider_priority_map) node_maps['priority map'] = if defined?(Chef.provider_priority_map)
Chef.provider_priority_map
else
require 'chef/platform/provider_priority_map'
Chef::Platform::ProviderPriorityMap.instance.send(:priority_map)
end
# Patch anything in the descendants tracker. # Patch anything in the descendants tracker.
Chef::Provider.descendants.each do |provider| Chef::Provider.descendants.each do |provider|
node_maps["#{provider} node map"] = provider.node_map if defined?(provider.node_map) node_maps["#{provider} node map"] = provider.node_map if defined?(provider.node_map)

View File

@ -16,5 +16,5 @@
module Poise module Poise
VERSION = '2.7.2' VERSION = '2.8.1'
end end

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,12 @@
This file is used to list changes made in each version of the users cookbook. This file is used to list changes made in each version of the users cookbook.
## 5.1.0 (2017-05-30)
- Keep ssh keys out of the chef logs
- Improve docs and examples
- Remove class_eval and require Chef 12.7+ as class_eval causes issues with later Chef 12 releases
## 5.0.0 (2017-04-17) ## 5.0.0 (2017-04-17)
### Breaking changes ### Breaking changes

View File

@ -10,8 +10,6 @@ This cookbook is concerned with the management of OS users and groups from datab
## Requirements ## Requirements
A data bag populated with user objects must exist. The default data bag in this recipe is `users`. See USAGE.
### Platforms ### Platforms
The following platforms have been tested with Test Kitchen: The following platforms have been tested with Test Kitchen:
@ -45,7 +43,7 @@ or to pin to a specific version of the users cookbook, in this case any version
depends 'users', '~> 2' depends 'users', '~> 2'
``` ```
Then in a recipe: Then in a recipe use the `user_manage` resource to add all users in the defined group to the system:
```ruby ```ruby
users_manage 'GROUPNAME' do users_manage 'GROUPNAME' do
@ -86,6 +84,16 @@ A sample user object in a users databag would look like:
} }
``` ```
A sample user to remove from a system would like like:
```json
{
"id": "mwaddams",
"action": "remove",
"groups": [ "testgroup", "nfsgroup" ]
}
```
### Databag Key Definitions ### Databag Key Definitions
- `id`: _String_ specifies the username, as well as the data bag object id. - `id`: _String_ specifies the username, as well as the data bag object id.
@ -262,21 +270,29 @@ And then change the action to "remove":
``` ```
- Note only user bags with the "action : remove" and a search-able "group" attribute will be purged by the :remove action. - Note only user bags with the "action : remove" and a search-able "group" attribute will be purged by the :remove action.
- As of v2.0.3 you can use the force parameter within the user data bag object for users with action remove. As per [user docs](https://docs.chef.io/resource_user.html) this may leave the system in an inconsistent state. For example, a user account will be removed even if the user is logged in. A users home directory will be removed, even if that directory is shared by multiple users. - As of v2.0.3 you can use the force parameter within the user data bag object for users with action remove. As per [user docs](https://docs.chef.io/resource_user.html) this may leave the system in an inconsistent state. For example, a user account will be removed even if the user is logged in. A user's home directory will be removed, even if that directory is shared by multiple users.
If you have different requirements, for example: If you have different requirements, for example:
- You want to search a different data bag specific to a role such as - You want to search a different data bag specific to a role such as
- mail. You may change the data_bag searched. - mail. You may change the data_bag searched.
- data_bag `mail` - data_bag `mail`
- You want to search for a different group attribute named - You want to search for a different group attribute named
- `postmaster`. You may change the search_group attribute. This - `postmaster`. You may change the search_group attribute. This
- attribute defaults to the LWRP resource name. - attribute defaults to the LWRP resource name.
- search_group `postmaster` - search_group `postmaster`
- You want to add the users to a security group other than the - You want to add the users to a security group other than the
- lightweight resource name. You may change the group_name attribute. - lightweight resource name. You may change the group_name attribute.
- This attribute also defaults to the LWRP resource name. - This attribute also defaults to the LWRP resource name.
- group_name `wheel` - group_name `wheel`
Putting these requirements together our recipe might look like this: Putting these requirements together our recipe might look like this:

File diff suppressed because one or more lines are too long

View File

@ -97,6 +97,7 @@ action :create do
owner u['uid'] ? validate_id(u['uid']) : u['username'] owner u['uid'] ? validate_id(u['uid']) : u['username']
group validate_id(u['gid']) if u['gid'] group validate_id(u['gid']) if u['gid']
mode '0600' mode '0600'
sensitive true
variables ssh_keys: u['ssh_keys'] variables ssh_keys: u['ssh_keys']
only_if { !!(u['ssh_keys']) } only_if { !!(u['ssh_keys']) }
end end
@ -157,7 +158,7 @@ action :remove do
end end
end end
action_class.class_eval do action_class do
include ::Users::Helpers include ::Users::Helpers
include ::Users::OsxHelper include ::Users::OsxHelper