Skip to content

Commit

Permalink
Merge pull request #35 from rightscale-cookbooks/ST-258_rhel_on_rax
Browse files Browse the repository at this point in the history
St 258 rhel on rax
  • Loading branch information
douglaswth committed Apr 24, 2015
2 parents 91d34d4 + b4ced1a commit d63b6a3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------

Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
27 changes: 27 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d63b6a3

Please sign in to comment.