Commit 8a37bc3e5f2d851458108c4e94a1f2d68d914a58

Authored by Earth Ugat
1 parent b1c36c6a

Bump to v0.2.2

  1 +# 0.2.2
  2 +
  3 +Separated the recipe for loading the schema and user initially.
  4 +
1 5 # 0.2.1
2 6
3 7 Recipe reload_from_s3 now properly downloads a .gz file, instead of .tar.gz.
... ...
... ... @@ -4,7 +4,7 @@ maintainer_email 'sysadmin @ chromedia.com'
4 4 license 'Apache License'
5 5 description 'Simplifies setup of MariaDB in Chromedia.'
6 6 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7   -version '0.2.1'
  7 +version '0.2.2'
8 8
9 9 {
10 10 'mariadb' => '0.3.1',
... ...
... ... @@ -30,11 +30,6 @@ chef_gem 'chef-rewind' do
30 30 end
31 31 require 'chef/rewind'
32 32
33   -mysql2_chef_gem 'default' do
34   - gem_version '0.4.4'
35   - action :install
36   -end
37   -
38 33 include_recipe 'mariadb'
39 34
40 35 # It looks like the service is sometimes not being restarted
... ... @@ -52,38 +47,4 @@ if not node['cfe-mariadb']['replication']
52 47 end
53 48 end
54 49
55   -# Prepare the needed databases and users.
56   -con = {
57   - :port => node['mariadb']['mysqld']['port'],
58   - :username => 'root',
59   - :password => node['mariadb']['server_root_password']
60   -}
61   -node['cfe-mariadb']['db_map'].each do |dbx|
62   -
63   - if dbx.is_a?(Array)
64   - dbx_name = dbx[0]
65   - dbx = dbx[1]
66   - else
67   - dbx_name = dbx[:db_name]
68   - end
69   -
70   - mysql_database dbx_name do
71   - connection con
72   - action :create
73   - if dbx.has_key?(:char_set)
74   - encoding dbx[:char_set]
75   - end
76   - if dbx.has_key?(:collate)
77   - collation dbx[:collate]
78   - end
79   - end
80   -
81   - mysql_database_user dbx[:db_user] do
82   - connection con
83   - password dbx[:db_pass]
84   - database_name dbx_name
85   - host '%'
86   - privileges [:all]
87   - action :grant
88   - end
89   -end
  50 +include_recipe "#{cookbook_name}::schema"
... ...
  1 +#
  2 +# Author:: Earth U (<sysadmin @ chromedia.com>)
  3 +# Cookbook Name:: cfe-mariadb
  4 +# Recipe:: schema
  5 +#
  6 +# Copyright 2016, Chromedia Far East, Inc.
  7 +#
  8 +# Licensed under the Apache License, Version 2.0 (the "License");
  9 +# you may not use this file except in compliance with the License.
  10 +# You may obtain a copy of the License at
  11 +#
  12 +# http://www.apache.org/licenses/LICENSE-2.0
  13 +#
  14 +# Unless required by applicable law or agreed to in writing, software
  15 +# distributed under the License is distributed on an "AS IS" BASIS,
  16 +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17 +# See the License for the specific language governing permissions and
  18 +# limitations under the License.
  19 +#
  20 +
  21 +mysql2_chef_gem 'default' do
  22 + gem_version '0.4.4'
  23 + provider Chef::Provider::Mysql2ChefGem::Mariadb
  24 + action :install
  25 +end
  26 +
  27 +# Prepare the needed databases and users.
  28 +con = {
  29 + :host => node['mariadb']['mysqld']['bind_address'],
  30 + :port => node['mariadb']['mysqld']['port'],
  31 + :username => 'root',
  32 + :password => node['mariadb']['server_root_password']
  33 +}
  34 +node['cfe-mariadb']['db_map'].each do |dbx|
  35 +
  36 + if dbx.is_a?(Array)
  37 + dbx_name = dbx[0]
  38 + dbx = dbx[1]
  39 + else
  40 + dbx_name = dbx[:db_name]
  41 + end
  42 +
  43 + mysql_database dbx_name do
  44 + connection con
  45 + action :create
  46 + if dbx.has_key?(:char_set)
  47 + encoding dbx[:char_set]
  48 + end
  49 + if dbx.has_key?(:collate)
  50 + collation dbx[:collate]
  51 + end
  52 + end
  53 +
  54 + mysql_database_user dbx[:db_user] do
  55 + connection con
  56 + password dbx[:db_pass]
  57 + database_name dbx_name
  58 + host '%'
  59 + privileges [:all]
  60 + action :grant
  61 + end
  62 +end
... ...