Downgrade mysql cookbook for now
It doesn't play well with our current dev server setup
This commit is contained in:
@@ -1 +0,0 @@
|
||||
~FC016
|
||||
@@ -1,22 +1,5 @@
|
||||
# mysql2_chef_gem CHANGELOG
|
||||
|
||||
## 2.0.1 (2017-03-28)
|
||||
|
||||
- Include usage examples for installing on a mariadb server and included a note in the readme regarding the 2.0 changes.
|
||||
|
||||
## 2.0.0 (2017-03-28)
|
||||
|
||||
- Converted the previously HWRP resources/providers to a custom resource. This changes the behavior of choosing to install on mysql or mariadb in a breaking way. Instead of specifying the providers you need to call the resources directly. Specifying mysql2_chef_gem will default to mysql, but using mariadb will require using the mysql2_chef_gem_mariadb resource directly.
|
||||
- Increase the minimum chef version to 12.5
|
||||
- Require mysql cookbook 8.2+ and build-essential cookbook 2.4+
|
||||
- Install the 0.4.5 gem by default
|
||||
- Expand test recipe to cover more scenarios
|
||||
- Switched testing to use Delivery local mode
|
||||
- Switched from kitchen-docker to kitchen-dokken and removed testing for CentOS 5 / Ubuntu 12.04 as these are both going EOL
|
||||
- Switched from Rubocop to cookstyle for linting
|
||||
- Removed yum/apt from the Berksfile
|
||||
- Remove test dependencies from the Gemfile and instead use ChefDK for testing
|
||||
|
||||
## 1.1.0 (2016-04-27)
|
||||
|
||||
- Added a chefignore file
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
# Mysql2 Chef Gem Installer Cookbook
|
||||
Mysql2 Chef Gem Installer Cookbook
|
||||
==================================
|
||||
|
||||
[](https://travis-ci.org/sinfomicien/mysql2_chef_gem) [](https://supermarket.chef.io/cookbooks/mysql2_chef_gem)
|
||||
[](https://travis-ci.org/sinfomicien/mysql2_chef_gem)
|
||||
[](https://supermarket.chef.io/cookbooks/mysql2_chef_gem)
|
||||
|
||||
mysql2_chef_gem is a library cookbook that provides a resource for installing the mysql2 gem against either mysql or mariadb depending on usage.
|
||||
mysql2_chef_gem is a library cookbook that provides an LWRP for use
|
||||
in recipes. It provides a wrapper around `chef_gem` called
|
||||
`mysql2_chef_gem` that eases the installation process, collecting the
|
||||
prerequisites and side-stepping the compilation phase arms race.
|
||||
|
||||
## Scope
|
||||
Scope
|
||||
-----
|
||||
This cookbook is concerned with the installation of the `mysql2`
|
||||
Rubygem into Chef's gem path. Installation into other Ruby
|
||||
environments, or installation of related gems such as `mysql` are
|
||||
outside the scope of this cookbook.
|
||||
|
||||
This cookbook is concerned with the installation of the `mysql2` Rubygem into Chef's gem path. Installation into other Ruby environments, or installation of related gems such as `mysql` are outside the scope of this cookbook.
|
||||
Requirements
|
||||
------------
|
||||
* Chef 11 or higher
|
||||
* Ruby 1.9 (preferably from the Chef full-stack installer)
|
||||
|
||||
## Requirements
|
||||
|
||||
- Chef 12.5+
|
||||
|
||||
## Platform Support
|
||||
|
||||
The following platforms have been tested with Test Kitchen and are known to work.
|
||||
Platform Support
|
||||
----------------
|
||||
The following platforms have been tested with Test Kitchen and are
|
||||
known to work.
|
||||
|
||||
```
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
@@ -26,24 +36,27 @@ The following platforms have been tested with Test Kitchen and are known to work
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mysql / centos-7 | | | X | X | X |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mysql / fedora | | | X | X | X |
|
||||
| Mysql2ChefGem::Mysql / fedora-20 | | | X | X | X |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mysql / debian-7 | | | X | | |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mysql / ubuntu-10.04 | | X | | | |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mysql / ubuntu-12.04 | | | X | | |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mysql / ubuntu-14.04 | | | X | X | |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mariadb / fedora | | | X | | |
|
||||
| Mysql2ChefGem::Mariadb / fedora-20 | | | X | | |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
| Mysql2ChefGem::Mariadb / ubuntu-14.04 | | | X | | |
|
||||
|---------------------------------------+-----+-----+-----+-----+-----|
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Usage
|
||||
-----
|
||||
Place a dependency on the mysql cookbook in your cookbook's metadata.rb
|
||||
|
||||
```ruby
|
||||
depends 'mysql2_chef_gem'
|
||||
depends 'mysql2_chef_gem', '~> 1.0'
|
||||
```
|
||||
|
||||
Then, in a recipe:
|
||||
@@ -54,50 +67,47 @@ mysql2_chef_gem 'default' do
|
||||
end
|
||||
```
|
||||
|
||||
### 2.0 Compatibility
|
||||
|
||||
In order to ensure compatibility with Chef 13, the 2.0 release of this cookbook changed the method used to specify installation against mariadb. Instead of specifying the underlying provider, you instead reference the mariadb specific resource. See the example below for the new syntax.
|
||||
|
||||
## Resources Overview
|
||||
|
||||
Resources Overview
|
||||
------------------
|
||||
### mysql2_chef_gem
|
||||
|
||||
The `mysql2_chef_gem` resource installs mysql client development dependencies and installs the `mysql2` rubygem into Chef's Ruby environment.
|
||||
The `mysql2_chef_gem` resource the build dependencies and installation
|
||||
of the `mysql2` rubygem into Chef's Ruby environment
|
||||
|
||||
#### Example
|
||||
|
||||
```ruby
|
||||
mysql2_chef_gem 'default' do
|
||||
gem_version '0.4.5'
|
||||
gem_version '0.3.17'
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
#### Properties
|
||||
|
||||
- `gem_version` - The version of the `mysql` Rubygem to install into the Chef environment. Defaults to '0.4.5' connector libraries
|
||||
- `package_version` - The version of the mysql client libraries to install and link against
|
||||
#### Parameters
|
||||
- `gem_version` - The version of the `mysql` Rubygem to install into
|
||||
the Chef environment. Defaults to '0.3.17'
|
||||
connector libraries
|
||||
- `client_version` - The version of the mysql client libraries to
|
||||
install and link against
|
||||
|
||||
#### Actions
|
||||
|
||||
- `:install` - Build and install the gem into the Chef environment
|
||||
- `:remove` - Delete the gem from the Chef environment
|
||||
|
||||
### mysql2_chef_gem_mariadb
|
||||
|
||||
To install the mysql2 gem against an installation of mariadb reference the `mysql2_chef_gem_mariadb` resource directly. This resource includes all the same properties of the standard `mysql2_chef_gem` resource.
|
||||
#### Providers
|
||||
Chef selects a default provider based on platform and version,
|
||||
but you can specify one if your platform support it.
|
||||
|
||||
```ruby
|
||||
mysql2_chef_gem_mariadb 'default' do
|
||||
mysql2_chef_gem 'default' do
|
||||
provider Chef::Provider::Mysql2ChefGem::Mariadb
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
## License & Authors
|
||||
|
||||
- Author:: Sean OMeara ([someara@sean.io](mailto:someara@sean.io))
|
||||
- Author:: Tim Smith ([tsmith@chef.io](mailto:tsmith@chef.io))
|
||||
- Author:: Nicolas Blanc([sinfomicien@gmail.com](mailto:sinfomicien@gmail.com))
|
||||
License & Authors
|
||||
-----------------
|
||||
- Author:: Sean OMeara (<someara@chef.io>)
|
||||
- Author:: Nicolas Blanc(<sinfomicien@gmail.com>)
|
||||
|
||||
```
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
class Chef
|
||||
class Provider
|
||||
class Mysql2ChefGem
|
||||
class Mariadb < Chef::Provider::LWRPBase
|
||||
use_inline_resources if defined?(use_inline_resources)
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :install do
|
||||
recipe_eval do
|
||||
run_context.include_recipe 'build-essential::default'
|
||||
end
|
||||
|
||||
# As a recipe: must rely on global node attributes
|
||||
recipe_eval do
|
||||
run_context.include_recipe 'mariadb::client'
|
||||
end
|
||||
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
version new_resource.gem_version
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
action :remove
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
class Chef
|
||||
class Provider
|
||||
class Mysql2ChefGem
|
||||
class Mysql < Chef::Provider::LWRPBase
|
||||
include Chef::DSL::IncludeRecipe
|
||||
use_inline_resources if defined?(use_inline_resources)
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :install do
|
||||
include_recipe 'build-essential::default'
|
||||
|
||||
# As a resource: can pass version from calling recipe
|
||||
mysql_client 'default' do
|
||||
version new_resource.client_version
|
||||
action :create
|
||||
end
|
||||
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
version new_resource.gem_version
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
action :remove
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
require 'chef/resource/lwrp_base'
|
||||
|
||||
class Chef
|
||||
class Resource
|
||||
class Mysql2ChefGem < Chef::Resource::LWRPBase
|
||||
self.resource_name = :mysql2_chef_gem
|
||||
actions :install, :remove
|
||||
default_action :install
|
||||
|
||||
attribute :mysql2_chef_gem_name, kind_of: String, name_attribute: true, required: true
|
||||
attribute :gem_version, kind_of: String, default: '0.3.17'
|
||||
attribute :client_version, kind_of: String, default: nil
|
||||
end
|
||||
end
|
||||
end
|
||||
17
cookbooks/mysql2_chef_gem/libraries/z_provider_mapping.rb
Normal file
17
cookbooks/mysql2_chef_gem/libraries/z_provider_mapping.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
#########
|
||||
# mysql2_chef_gem
|
||||
#########
|
||||
Chef::Platform.set platform: :amazon, resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :centos, version: '< 7.0', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :centos, version: '>= 7.0', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :debian, resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :fedora, version: '< 19', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :fedora, version: '>= 19', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :omnios, resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :redhat, version: '< 7.0', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :redhat, version: '>= 7.0', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :scientific, version: '< 7.0', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :scientific, version: '>= 7.0', resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :smartos, resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :suse, resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
Chef::Platform.set platform: :ubuntu, resource: :mysql2_chef_gem, provider: Chef::Provider::Mysql2ChefGem::Mysql
|
||||
File diff suppressed because one or more lines are too long
@@ -1,29 +0,0 @@
|
||||
property :mysql2_chef_gem_name, String, name_attribute: true, required: true
|
||||
property :gem_version, String, default: '0.4.5'
|
||||
property :package_version, String
|
||||
|
||||
provides :mysql2_chef_gem_mariadb
|
||||
|
||||
action :install do
|
||||
recipe_eval do
|
||||
run_context.include_recipe 'build-essential::default'
|
||||
end
|
||||
|
||||
# As a recipe: must rely on global node attributes
|
||||
recipe_eval do
|
||||
run_context.include_recipe 'mariadb::client'
|
||||
end
|
||||
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
version new_resource.gem_version
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
action :remove
|
||||
end
|
||||
end
|
||||
@@ -1,29 +0,0 @@
|
||||
property :mysql2_chef_gem_name, String, name_attribute: true, required: true
|
||||
property :gem_version, String, default: '0.4.5'
|
||||
property :package_version, String
|
||||
|
||||
provides :mysql2_chef_gem
|
||||
provides :mysql2_chef_gem_mysql
|
||||
|
||||
action :install do
|
||||
include_recipe 'build-essential::default'
|
||||
|
||||
# As a resource: can pass version from calling recipe
|
||||
mysql_client 'default' do
|
||||
version new_resource.package_version if new_resource.package_version
|
||||
action :create
|
||||
end
|
||||
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
version new_resource.gem_version
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
gem_package 'mysql2' do
|
||||
gem_binary RbConfig::CONFIG['bindir'] + '/gem'
|
||||
action :remove
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user