Skip to content

Commit

Permalink
Merge pull request #15 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 56078eb + 04b0639 commit 382ffdc
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-storage Cookbook CHANGELOG

This file is used to list changes made in each version of the rs-storage cookbook.

v1.0.6
------

- On RHEL, depending on cloud, check and wait for RHEL repos to be installed.

v1.0.5
------

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 'Provides recipes for managing volumes on a Server in a RightScale supported cloud'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0.5'
version '1.0.6'

depends 'chef_handler', '~> 1.1.6'
depends 'filesystem', '~> 0.10.0'
Expand Down
27 changes: 27 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,32 @@
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

include_recipe 'rightscale_volume::default'
include_recipe 'rightscale_backup::default'

0 comments on commit 382ffdc

Please sign in to comment.