diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a60b7e..0168bd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ rs-mysql Cookbook CHANGELOG This file is used to list changes made in each version of the rs-mysql cookbook. +v1.1.7 +------ + +- On RHEL, depending on cloud, check and wait for RHEL repos to be installed. + v1.1.6 ------ diff --git a/metadata.rb b/metadata.rb index c74d70c..72e330b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs and configures a MySQL server' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.6' +version '1.1.7' depends 'chef_handler', '~> 1.1.6' depends 'marker', '~> 1.0.1' diff --git a/recipes/default.rb b/recipes/default.rb index 810b337..5ce08be 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -21,6 +21,33 @@ template 'rightscale_audit_entry.erb' end +# RHEL on some clouds take some time to add RHEL repos. +# Check and wait a few seconds if RHEL repos are not yet installed. +if node['platform'] == 'redhat' + if !node.attribute?('cloud') || !node['cloud'].attribute?('provider') || !node.attribute?(node['cloud']['provider']) + log "Not running on a known cloud - skipping check for RHEL repo" + else + # Depending on cloud, add string returned by 'yum --cacheonly repolist' to determine if RHEL repo has been added. + case node['cloud']['provider'] + when 'rackspace' + repo_id_partial = 'rhel-x86_64-server' + else + # Check to be skipped since cloud not in list. + repo_id_partial = nil + end + + unless repo_id_partial.nil? + Timeout.timeout(300) do + loop do + check_rhel_repo = Mixlib::ShellOut.new("yum --cacheonly repolist | grep #{repo_id_partial}").run_command + check_rhel_repo.exitstatus == 0 ? break : sleep(1) + end + end + end + + end +end + # Override the mysql/bind_address attribute with the server IP since # node['cloud']['local_ipv4'] returns an inconsistent type on AWS (String) and Google (Array) clouds bind_ip_address = RsMysql::Helper.get_bind_ip_address(node)