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_ruby', '~> 4.1.0'
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 'hostname', '~> 0.4.2'
cookbook 'firewall', '~> 2.6.2'

View File

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

View File

@ -1,5 +1,10 @@
# 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
* New version list for Node.js.

View File

@ -317,7 +317,7 @@ The Poise test server infrastructure is sponsored by [Rackspace](https://rackspa
## License
Copyright 2015-2016, Noah Kantrowitz
Copyright 2015-2017, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# you may not use this file except in compliance with the License.
@ -27,7 +27,7 @@ module PoiseJavascript
provides(:nodejs)
include PoiseLanguages::Static(
# 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},
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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# you may not use this file except in compliance with the License.
@ -16,5 +16,5 @@
module PoiseJavascript
VERSION = '1.1.0'
VERSION = '1.2.0'
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");
# 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");
# you may not use this file except in compliance with the License.

View File

@ -1,5 +1,10 @@
# Changelog
## v2.1.1
* Fix the SCL repository enable command for RHEL.
* Internal refactoring of the system package installer.
## v2.1.0
* 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.
repo_name = "rhel-server-rhscl-#{node['platform_version'][0]}-rpms"
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
else
package 'centos-release-scl-rh' do

View File

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

View File

@ -16,5 +16,5 @@
module PoiseLanguages
VERSION = '2.1.0'
VERSION = '2.1.1'
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
## v2.3.0
* Chef 13 support.
## v2.2.0
* 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
Copyright 2015-2016, Noah Kantrowitz
Copyright 2015-2017, Noah Kantrowitz
Licensed under the Apache License, Version 2.0 (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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# you may not use this file except in compliance with the License.
@ -128,7 +128,7 @@ module PoiseRuby
#
# @return [String]
def bundler_binary
@bundler_binary ||= ::File.join(gem_bindir, 'bundle')
@bundler_binary ||= ::File.join(poise_gem_bindir, 'bundle')
end
# 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
# 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]
def gem_bindir
def poise_gem_bindir
cmd = ruby_shell_out!(new_resource.gem_binary, 'environment')
# Parse a line like:
# - 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# 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");
# you may not use this file except in compliance with the License.
@ -16,5 +16,5 @@
module PoiseRuby
VERSION = '2.2.0'
VERSION = '2.3.0'
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");
# 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");
# you may not use this file except in compliance with the License.

View File

@ -1,5 +1,16 @@
# 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
* Test harness fixes for Chef.

View File

@ -69,7 +69,7 @@ end
# include Poise(container: true)
def Poise(options={})
# Allow passing a class as a shortcut
if options.is_a?(Class)
if options.is_a?(Class) || options.is_a?(Symbol)
options = {parent: options}
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))
# Cast to a set at definition time.
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.
define_method(name.to_sym) do |arg=nil, &block|
iv_sym = :"@#{name}"

View File

@ -14,6 +14,12 @@
# 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/helpers/resource_name'
@ -39,7 +45,12 @@ module Poise
# Deal with the node maps.
node_maps = {}
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.
Chef::Provider.descendants.each do |provider|
node_maps["#{provider} node map"] = provider.node_map if defined?(provider.node_map)

View File

@ -16,5 +16,5 @@
module Poise
VERSION = '2.7.2'
VERSION = '2.8.1'
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.
## 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)
### Breaking changes

View File

@ -10,8 +10,6 @@ This cookbook is concerned with the management of OS users and groups from datab
## Requirements
A data bag populated with user objects must exist. The default data bag in this recipe is `users`. See USAGE.
### Platforms
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'
```
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
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
- `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.
- 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:
- You want to search a different data bag specific to a role such as
- mail. You may change the data_bag searched.
- data_bag `mail`
- You want to search for a different group attribute named
- `postmaster`. You may change the search_group attribute. This
- attribute defaults to the LWRP resource name.
- search_group `postmaster`
- You want to add the users to a security group other than the
- lightweight resource name. You may change the group_name attribute.
- This attribute also defaults to the LWRP resource name.
- group_name `wheel`
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']
group validate_id(u['gid']) if u['gid']
mode '0600'
sensitive true
variables ssh_keys: u['ssh_keys']
only_if { !!(u['ssh_keys']) }
end
@ -157,7 +158,7 @@ action :remove do
end
end
action_class.class_eval do
action_class do
include ::Users::Helpers
include ::Users::OsxHelper