From 424046753978ac015ccf19c6acc4e54c34c367e5 Mon Sep 17 00:00:00 2001 From: Yi Ming Yin Date: Sun, 15 Feb 2015 18:03:23 +0800 Subject: [PATCH] Mapping platform 'redhat' to 'rhel' for redhat platform Default yum repo of mariadb on http://yum.mariadb.org/ uses 'rhel' for redhat platform, but ohai returns node['platform'] as 'redhat'. Needs to do the mapping in repository.rb Fix some rubocop issues. --- recipes/_redhat_galera.rb | 5 ++--- recipes/_redhat_server.rb | 4 ++-- recipes/repository.rb | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/recipes/_redhat_galera.rb b/recipes/_redhat_galera.rb index 39593504..8d725db0 100644 --- a/recipes/_redhat_galera.rb +++ b/recipes/_redhat_galera.rb @@ -17,12 +17,11 @@ # limitations under the License. # -#To force removing of mariadb-libs on CentOS >= 7 +# To force removing of mariadb-libs on CentOS >= 7 package 'MariaDB-shared' do - action:install + action :install end - package 'MariaDB-Galera-server' do action :install notifies :create, 'directory[/var/log/mysql]', :immediately diff --git a/recipes/_redhat_server.rb b/recipes/_redhat_server.rb index 0ff371fa..c279a2b1 100644 --- a/recipes/_redhat_server.rb +++ b/recipes/_redhat_server.rb @@ -17,9 +17,9 @@ # limitations under the License. # -#To force removing of mariadb-libs on CentOS >= 7 +# To force removing of mariadb-libs on CentOS >= 7 package 'MariaDB-shared' do - action:install + action :install end package 'MariaDB-server' do diff --git a/recipes/repository.rb b/recipes/repository.rb index 637b3616..4720cbfd 100644 --- a/recipes/repository.rb +++ b/recipes/repository.rb @@ -21,10 +21,15 @@ when 'yum' include_recipe 'yum::default' + if node['platform'] == 'redhat' + target_platform = "rhel#{node['platform_version'].to_i}" + else + target_platform = "#{node['platform']}#{node['platform_version'].to_i}" + end yum_repository "mariadb-#{node['mariadb']['install']['version']}" do description 'MariaDB Official Repository' baseurl 'http://yum.mariadb.org/' + \ - node['mariadb']['install']['version'] + "/#{node['platform']}#{node['platform_version'].to_i}-amd64" + node['mariadb']['install']['version'] + "/#{target_platform}-amd64" gpgkey 'https://yum.mariadb.org/RPM-GPG-KEY-MariaDB' action :create end