Update cookbooks and add wordpress cookbook

This commit is contained in:
Greg Karékinian
2016-02-19 18:09:49 +01:00
parent 9ba973e3ac
commit 820b0ab3f8
606 changed files with 22421 additions and 14084 deletions

View File

@@ -1,51 +1,67 @@
ohai Cookbook CHANGELOG
=======================
# ohai Cookbook CHANGELOG
This file is used to list changes made in each version of the ohai cookbook.
## v2.1.0 (2016-01-26)
- Properly handle creating ohai hints without specifying the content. Previously if the content wasn't specified a deprecation notice would be thrown and the file would not be created
- Simplified the test suite and added inspec tests to ensure hints are created, especially if the content is not specified
- Added FreeBSD and Windows as supported platform in the metadata and add them to the Test Kitchen config
- Add Test Kitchen integration tests to Travis CI
- Updated testing Gems to the latest releases in the Gemfile
v2.0.1 (2014-06-07)
-------------------
* [COOK-4683] Remove warnings about reopening resource
## v2.0.4 (2015-10-30)
- Resolved deprecation warnings with the Chefspec matchers
Please note, this changes the name of a remote_directory resource. It is not expected that anyone would be explicitly notifying this resource but, please review [PR #16](https://github.com/opscode-cookbooks/ohai/pull/16/files) for more info.
## v2.0.3 (2015-10-21)
- Validate the hints before loading them to avoid failures
- Added supported platforms to the metadata
- Updated .gitignore file
- Updated Test Kitchen config for the latest platforms
- Added Chef standard Rubocop config
- Added Travis CI testing
- Added Berksfile
- Updated contributing and testing docs
- Added maintainers.md and maintainers.toml files
- Added Travis and cookbook version badges to the readme
- Expanded the requirements section in the readme and clarify the minimum supported Chef release is 11
- Updated Opscode -> Chef Software
- Added a Rakefile for simplified testing
- Added a Chefignore file
- Resolved Rubocop warnings
- Added source_url and issues_url to the metadata
- Added Chefspec matchers
- Added basic convergence Chefspec test
## v2.0.1 (2014-06-07)
- [COOK-4683] Remove warnings about reopening resource
v2.0.0 (2014-02-25)
-------------------
Please note, this changes the name of a remote_directory resource. It is not expected that anyone would be explicitly notifying this resource but, please review [PR #16](https://github.com/chef-cookbooks/ohai/pull/16/files) for more info.
## v2.0.0 (2014-02-25)
'[COOK-3865] - create lwrp ohai_hint'
v1.1.12
-------
## v1.1.12
- Dummy release due to a Community Site upload failure
v1.1.10
-------
## v1.1.10
### Bug
- **[COOK-3091](https://tickets.opscode.com/browse/COOK-3091)** - Fix checking `Chef::Config[:config_file]`
- **[COOK-3091](https://tickets.chef.io/browse/COOK-3091)** - Fix checking `Chef::Config[:config_file]`
v1.1.8
------
## v1.1.8
- [COOK-1918] - Ohai cookbook to distribute plugins fails on windows
- [COOK-2096] - Ohai cookbook sets unix-only default path attribute
v1.1.6
------
## v1.1.6
- [COOK-2057] - distribution from another cookbok fails if ohai attributes are loaded after the other cookbook
v1.1.4
------
## v1.1.4
- [COOK-1128] - readme update, Replace reference to deprecated chef cookbook with one to chef-client
v1.1.2
------
## v1.1.2
- [COOK-1424] - prevent plugin_path growth to infinity
v1.1.0
------
## v1.1.0
- [COOK-1174] - custom_plugins is only conditionally available
- [COOK-1383] - allow plugins from other cookbooks
v1.0.2
------
## v1.0.2
- [COOK-463] ohai cookbook default recipe should only reload plugins if there were updates

View File

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

View File

@@ -0,0 +1,19 @@
<!-- 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 simple majority of maintainers
for the relevant subsystems 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)
* [Sean OMeara](https://github.com/someara)
* [Tim Smith](https://github.com/tas50)
* [Thom May](https://github.com/thommay)

View File

@@ -1,59 +1,64 @@
ohai Cookbook
=============
# ohai Cookbook
[![Build Status](https://travis-ci.org/chef-cookbooks/ohai.svg?branch=master)](https://travis-ci.org/chef-cookbooks/ohai) [![Cookbook Version](https://img.shields.io/cookbook/v/ohai.svg)](https://supermarket.chef.io/cookbooks/ohai)
Creates a configured plugin path for distributing custom Ohai plugins, and reloads them via Ohai within the context of a Chef Client run during the compile phase (if needed).
## Requirements
### Platforms
- Debian/Ubuntu
- RHEL/CentOS/Scientific/Amazon/Oracle
- FreeBSD
- Windows
Attributes
----------
### Chef
- Chef 11+
### Cookbooks
- none
## Attributes
- `node['ohai']['plugin_path']` - location to drop off plugins directory, default is `/etc/chef/ohai_plugins`. This is not FHS-compliant, an FHS location would be something like `/var/lib/ohai/plugins`, or `/var/lib/chef/ohai_plugins` or similar.
Neither an FHS location or the default value of this attribute are in the default Ohai plugin path. Set the Ohai plugin path with the config setting "`Ohai::Config[:plugin_path]`" in the Chef config file (the `chef-client::config` recipe does this automatically for you!). The attribute is not set to the default plugin path that Ohai ships with because we don't want to risk destroying existing essential plugins for Ohai.
- `node['ohai']['plugins']` - sources of plugins, defaults to the `files/default/plugins` directory of this cookbook. You can add additional cookbooks by adding the name of the cookbook as a key and the path of the files directory as the value. You have to make sure that you don't have any file conflicts between multiple cookbooks. The last one to write wins.
- `node['ohai']['hints_path']` - location to drop off hints directory, default is `/etc/chef/ohai/hints`.
Usage
-----
## Usage
Put the recipe `ohai` at the start of the node's run list to make sure that custom plugins are loaded early on in the Chef run and data is available for later recipes.
The execution of the custom plugins occurs within the recipe during the compile phase, so you can write new plugins and use the data they return in your Chef recipes.
For information on how to write custom plugins for Ohai, please see the Chef wiki pages.
http://wiki.opscode.com/display/chef/Writing+Ohai+Plugins
[http://wiki.chef.io/display/chef/Writing+Ohai+Plugins](http://wiki.chef.io/display/chef/Writing+Ohai+Plugins)
*PLEASE NOTE* - This recipe reloads the Ohai plugins a 2nd time during the Chef run if:
* The "`Ohai::Config[:plugin_path]`" config setting has *NOT* been properly set in the Chef config file
_PLEASE NOTE_ - This recipe reloads the Ohai plugins a 2nd time during the Chef run if:
- The "`Ohai::Config[:plugin_path]`" config setting has _NOT_ been properly set in the Chef config file
- The "`Ohai::Config[:plugin_path]`" config setting has been properly set in the Chef config file and there are updated plugins dropped off at "`node['ohai']['plugin_path']`".
LWRP
----
## LWRP
### `ohai_hint`
Create hints file. You can find usage examples at `test/cookbooks/ohai_test/recipes/*.rb`.
#### Resource Attributes
- `hint_name` - The name of hints file and key. Should be string, default is name of resource.
- `content` - Values of hints. It will be used as automatic attributes. Should be Hash, default is empty Hash class.
- `hint_name` - The name of hints file and key. Should be string, default is name of resource.
- `content` - Values of hints. It will be used as automatic attributes. Should be Hash, default is empty Hash class.
#### ChefSpec Matchers
You can check for the creation or deletion of ohai hints with chefspec using these custom matches:
- create_ohai_hint
- delete_ohai_hint
Example
-------
## Example
For an example implementation, inspect the ohai_plugin.rb recipe in the nginx community cookbook.
## License & Authors
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
License & Authors
-----------------
- Author:: Joshua Timberman (<joshua@opscode.com>)
- Author:: Seth Chisamore (<schisamo@opscode.com>)
```text
Copyright:: 2010-2011, Opscode, Inc
**Copyright:** 2011-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

View File

@@ -2,7 +2,7 @@
# Cookbook Name:: ohai
# Attribute:: default
#
# Copyright 2010, Opscode, Inc
# 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.
@@ -18,14 +18,14 @@
#
# FHS location would be /var/lib/chef/ohai_plugins or similar.
case node["platform_family"]
when "windows"
default["ohai"]["plugin_path"] = "C:/chef/ohai_plugins"
default["ohai"]["hints_path"] = "C:/chef/ohai/hints"
case node['platform_family']
when 'windows'
default['ohai']['plugin_path'] = "#{ENV['systemdrive']}/chef/ohai_plugins"
default['ohai']['hints_path'] = "#{ENV['systemdrive']}/chef/ohai/hints"
else
default["ohai"]["plugin_path"] = "/etc/chef/ohai_plugins"
default["ohai"]["hints_path"] = "/etc/chef/ohai/hints"
default['ohai']['plugin_path'] = '/etc/chef/ohai_plugins'
default['ohai']['hints_path'] = '/etc/chef/ohai/hints'
end
# The list of plugins and their respective file locations
default["ohai"]["plugins"]["ohai"] = "plugins"
default['ohai']['plugins']['ohai'] = 'plugins'

View File

@@ -0,0 +1,21 @@
# encoding: utf-8
if defined?(ChefSpec)
if ChefSpec.respond_to?(:define_matcher)
# ChefSpec >= 4.1
ChefSpec.define_matcher(:ohai_hint)
elsif defined?(ChefSpec::Runner) &&
ChefSpec::Runner.respond_to?(:define_runner_method)
# ChefSpec < 4.1
ChefSpec::Runner.define_runner_method(:ohai_hint)
end
def create_ohai_hint(resource)
ChefSpec::Matchers::ResourceMatcher.new(:ohai_hint, :create, resource)
end
def delete_ohai_hint(resource)
ChefSpec::Matchers::ResourceMatcher.new(:ohai_hint, :delete, resource)
end
end

View File

@@ -1,46 +1 @@
{
"name": "ohai",
"version": "2.0.1",
"description": "Distributes a directory of custom ohai plugins",
"long_description": "ohai Cookbook\n=============\nCreates a configured plugin path for distributing custom Ohai plugins, and reloads them via Ohai within the context of a Chef Client run during the compile phase (if needed).\n\n\nAttributes\n----------\n- `node['ohai']['plugin_path']` - location to drop off plugins directory, default is `/etc/chef/ohai_plugins`. This is not FHS-compliant, an FHS location would be something like `/var/lib/ohai/plugins`, or `/var/lib/chef/ohai_plugins` or similar.\n\n Neither an FHS location or the default value of this attribute are in the default Ohai plugin path. Set the Ohai plugin path with the config setting \"`Ohai::Config[:plugin_path]`\" in the Chef config file (the `chef-client::config` recipe does this automatically for you!). The attribute is not set to the default plugin path that Ohai ships with because we don't want to risk destroying existing essential plugins for Ohai.\n\n- `node['ohai']['plugins']` - sources of plugins, defaults to the `files/default/plugins` directory of this cookbook. You can add additional cookbooks by adding the name of the cookbook as a key and the path of the files directory as the value. You have to make sure that you don't have any file conflicts between multiple cookbooks. The last one to write wins.\n\n- `node['ohai']['hints_path']` - location to drop off hints directory, default is `/etc/chef/ohai/hints`.\n\nUsage\n-----\nPut the recipe `ohai` at the start of the node's run list to make sure that custom plugins are loaded early on in the Chef run and data is available for later recipes.\n\nThe execution of the custom plugins occurs within the recipe during the compile phase, so you can write new plugins and use the data they return in your Chef recipes.\n\nFor information on how to write custom plugins for Ohai, please see the Chef wiki pages.\n\nhttp://wiki.opscode.com/display/chef/Writing+Ohai+Plugins\n\n*PLEASE NOTE* - This recipe reloads the Ohai plugins a 2nd time during the Chef run if:\n\n* The \"`Ohai::Config[:plugin_path]`\" config setting has *NOT* been properly set in the Chef config file\n- The \"`Ohai::Config[:plugin_path]`\" config setting has been properly set in the Chef config file and there are updated plugins dropped off at \"`node['ohai']['plugin_path']`\".\n\nLWRP\n----\n\n### `ohai_hint`\n\nCreate hints file. You can find usage examples at `test/cookbooks/ohai_test/recipes/*.rb`.\n\n#### Resource Attributes\n\n - `hint_name` - The name of hints file and key. Should be string, default is name of resource.\n - `content` - Values of hints. It will be used as automatic attributes. Should be Hash, default is empty Hash class.\n\n\nExample\n-------\nFor an example implementation, inspect the ohai_plugin.rb recipe in the nginx community cookbook.\n\n\nLicense & Authors\n-----------------\n- Author:: Joshua Timberman (<joshua@opscode.com>)\n- Author:: Seth Chisamore (<schisamo@opscode.com>)\n\n```text\nCopyright:: 2010-2011, Opscode, 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": "Opscode, Inc",
"maintainer_email": "cookbooks@opscode.com",
"license": "Apache 2.0",
"platforms": {
},
"dependencies": {
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
"ohai/plugin_path": {
"display_name": "Ohai Plugin Path",
"description": "Distribute plugins to this path.",
"type": "string",
"required": "optional",
"default": "/etc/chef/ohai_plugins"
},
"ohai/plugins": {
"display_name": "Ohai Plugin Sources",
"description": "Read plugins from these cookbooks and paths",
"type": "hash",
"required": "optional",
"default": {
"ohai": "plugins"
}
}
},
"groupings": {
},
"recipes": {
"ohai::default": "Distributes a directory of custom ohai plugins"
}
}
{"name":"ohai","version":"2.1.0","description":"Distributes a directory of custom ohai plugins","long_description":"# ohai Cookbook\n[![Build Status](https://travis-ci.org/chef-cookbooks/ohai.svg?branch=master)](https://travis-ci.org/chef-cookbooks/ohai) [![Cookbook Version](https://img.shields.io/cookbook/v/ohai.svg)](https://supermarket.chef.io/cookbooks/ohai)\n\nCreates a configured plugin path for distributing custom Ohai plugins, and reloads them via Ohai within the context of a Chef Client run during the compile phase (if needed).\n\n## Requirements\n### Platforms\n- Debian/Ubuntu\n- RHEL/CentOS/Scientific/Amazon/Oracle\n- FreeBSD\n- Windows\n\n### Chef\n- Chef 11+\n\n### Cookbooks\n- none\n\n## Attributes\n- `node['ohai']['plugin_path']` - location to drop off plugins directory, default is `/etc/chef/ohai_plugins`. This is not FHS-compliant, an FHS location would be something like `/var/lib/ohai/plugins`, or `/var/lib/chef/ohai_plugins` or similar.\n\n Neither an FHS location or the default value of this attribute are in the default Ohai plugin path. Set the Ohai plugin path with the config setting \"`Ohai::Config[:plugin_path]`\" in the Chef config file (the `chef-client::config` recipe does this automatically for you!). The attribute is not set to the default plugin path that Ohai ships with because we don't want to risk destroying existing essential plugins for Ohai.\n\n- `node['ohai']['plugins']` - sources of plugins, defaults to the `files/default/plugins` directory of this cookbook. You can add additional cookbooks by adding the name of the cookbook as a key and the path of the files directory as the value. You have to make sure that you don't have any file conflicts between multiple cookbooks. The last one to write wins.\n- `node['ohai']['hints_path']` - location to drop off hints directory, default is `/etc/chef/ohai/hints`.\n\n## Usage\nPut the recipe `ohai` at the start of the node's run list to make sure that custom plugins are loaded early on in the Chef run and data is available for later recipes.\n\nThe execution of the custom plugins occurs within the recipe during the compile phase, so you can write new plugins and use the data they return in your Chef recipes.\n\nFor information on how to write custom plugins for Ohai, please see the Chef wiki pages.\n\n[http://wiki.chef.io/display/chef/Writing+Ohai+Plugins](http://wiki.chef.io/display/chef/Writing+Ohai+Plugins)\n\n_PLEASE NOTE_ - This recipe reloads the Ohai plugins a 2nd time during the Chef run if:\n- The \"`Ohai::Config[:plugin_path]`\" config setting has _NOT_ been properly set in the Chef config file\n- The \"`Ohai::Config[:plugin_path]`\" config setting has been properly set in the Chef config file and there are updated plugins dropped off at \"`node['ohai']['plugin_path']`\".\n\n## LWRP\n### `ohai_hint`\nCreate hints file. You can find usage examples at `test/cookbooks/ohai_test/recipes/*.rb`.\n\n#### Resource Attributes\n- `hint_name` - The name of hints file and key. Should be string, default is name of resource.\n- `content` - Values of hints. It will be used as automatic attributes. Should be Hash, default is empty Hash class.\n\n#### ChefSpec Matchers\nYou can check for the creation or deletion of ohai hints with chefspec using these custom matches:\n- create_ohai_hint\n- delete_ohai_hint\n\n## Example\nFor an example implementation, inspect the ohai_plugin.rb recipe in the nginx community cookbook.\n\n## License & Authors\n**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))\n\n**Copyright:** 2011-2016, Chef Software, Inc.\n\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":{"ubuntu":">= 0.0.0","debian":">= 0.0.0","centos":">= 0.0.0","redhat":">= 0.0.0","amazon":">= 0.0.0","scientific":">= 0.0.0","fedora":">= 0.0.0","oracle":">= 0.0.0","freebsd":">= 0.0.0","windows":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"ohai::default":"Distributes a directory of custom ohai plugins"}}

View File

@@ -1,23 +0,0 @@
name "ohai"
maintainer "Opscode, Inc"
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Distributes a directory of custom ohai plugins"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2.0.1"
recipe "ohai::default", "Distributes a directory of custom ohai plugins"
attribute "ohai/plugin_path",
:display_name => "Ohai Plugin Path",
:description => "Distribute plugins to this path.",
:type => "string",
:required => "optional",
:default => "/etc/chef/ohai_plugins"
attribute "ohai/plugins",
:display_name => "Ohai Plugin Sources",
:description => "Read plugins from these cookbooks and paths",
:type => "hash",
:required => "optional",
:default => {'ohai' => 'plugins'}

View File

@@ -2,33 +2,44 @@ def why_run_supported?
true
end
def build_ohai_hint_path
::File.join(node[:ohai][:hints_path], "#{new_resource.name}.json")
def ohai_hint_path
::File.join(node['ohai']['hints_path'], "#{new_resource.name}.json")
end
def build_content
# passing nil to file produces deprecation warnings so pass an empty string
return '' if new_resource.content.nil? || new_resource.content.empty?
JSON.pretty_generate(new_resource.content)
end
use_inline_resources
action :create do
if @current_resource.content != new_resource.content
directory node[:ohai][:hints_path] do
# don't create the file if the existing file was empty and so is the new one
# this avoids bogus content updates on every chef run
unless (@current_resource.content && @current_resource.content.empty?) && new_resource.content.nil?
directory node['ohai']['hints_path'] do
action :create
recursive true
end
file build_ohai_hint_path do
file ohai_hint_path do
action :create
content JSON.pretty_generate(new_resource.content)
content build_content
end
end
end
def load_current_resource
@current_resource = Chef::Resource::OhaiHint.new(new_resource.name)
if ::File.exist?(build_ohai_hint_path)
@current_resource.content(JSON.parse(::File.read(build_ohai_hint_path)))
else
@current_resource.content(nil)
if ::File.exist?(ohai_hint_path)
Chef::Log.debug("Existing ohai hint at #{ohai_hint_path} found. Attempting to parse JSON")
begin
@current_resource.content(JSON.parse(::File.read(ohai_hint_path)))
rescue JSON::ParserError
@current_resource.content({})
Chef::Log.debug("Could not parse JSON in ohai hint at #{ohai_hint_path}. It's probably an empty hint file")
end
end
@current_resource

View File

@@ -2,7 +2,7 @@
# Cookbook Name:: ohai
# Recipe:: default
#
# Copyright 2011, Opscode, Inc
# Copyright 2011-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.
@@ -29,7 +29,6 @@ Chef::Log.info("ohai plugins will be at: #{node['ohai']['plugin_path']}")
# This is done during the compile phase so new plugins can be used in
# resources later in the run.
node['ohai']['plugins'].each_pair do |source_cookbook, path|
rd = remote_directory "#{node['ohai']['plugin_path']} for cookbook #{source_cookbook}" do
path node['ohai']['plugin_path']
cookbook source_cookbook
@@ -50,6 +49,4 @@ end
# Reload ohai if the client's plugin_path did not contain
# node['ohai']['plugin_path'], or new plugins were loaded
if reload_ohai
resource.run_action(:reload)
end
resource.run_action(:reload) if reload_ohai

View File

@@ -1,6 +1,5 @@
actions :create, :delete
default_action :create
attribute :hint_name, :kind_of => String, :name_attribute => true
attribute :content, :kind_of => Hash, :default => {}
attribute :hint_name, kind_of: String, name_attribute: true
attribute :content, kind_of: Hash