Skip to content

Commit

Permalink
Merge pull request #17 from rightscale-cookbooks/st_15_02_remove_clou…
Browse files Browse the repository at this point in the history
…dstack_ip_workaround

Removed workaround logic that handled cloudstack behaviour with IP addre...
  • Loading branch information
EfrainOlivares committed Jan 21, 2015
2 parents 4480f14 + 2d15a4a commit f72dd81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ rightscale_tag Cookbook CHANGELOG

This file is used to list changes made in each version of the rightscale_tag cookbook.

v1.0.6
------

- Remove workaround logic to handle cloudstack behaviour with IP addresses.

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 LWRPs and helper methods for building 3-tier applications using machine tags in RightScale'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0.5'
version '1.0.6'

depends 'machine_tag', '~> 1.0.3'
depends 'marker', '~> 1.0.0'
Expand Down
24 changes: 7 additions & 17 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,15 @@
end

if node['cloud']
# For cloudstack, ignore 'cloud/public_ips' and determine if
# 'cloud/private_ips' are private or public IPs and set tags accordingly.
if node['cloud']['provider'] == 'cloudstack'
if node['cloud']['private_ips']
private_ips, public_ips = node['cloud']['private_ips'].reject { |ip| ip.nil? || ip.empty? }.partition { |ip| IPAddress(ip).private? }
public_ips.each_with_index { |public_ip, index| machine_tag "server:public_ip_#{index}=#{public_ip}" }
private_ips.each_with_index { |private_ip, index| machine_tag "server:private_ip_#{index}=#{private_ip}" }
end
else
if node['cloud']['public_ips']
node['cloud']['public_ips'].reject { |ip| ip.nil? || ip.empty? || IPAddress(ip).private? }.each_with_index do |public_ip, index|
machine_tag "server:public_ip_#{index}=#{public_ip}"
end
if node['cloud']['public_ips']
node['cloud']['public_ips'].reject { |ip| ip.nil? || ip.empty? || IPAddress(ip).private? }.each_with_index do |public_ip, index|
machine_tag "server:public_ip_#{index}=#{public_ip}"
end
end

if node['cloud']['private_ips']
node['cloud']['private_ips'].reject { |ip| ip.nil? || ip.empty? || !IPAddress(ip).private? }.each_with_index do |private_ip, index|
machine_tag "server:private_ip_#{index}=#{private_ip}"
end
if node['cloud']['private_ips']
node['cloud']['private_ips'].reject { |ip| ip.nil? || ip.empty? || !IPAddress(ip).private? }.each_with_index do |private_ip, index|
machine_tag "server:private_ip_#{index}=#{private_ip}"
end
end
end

0 comments on commit f72dd81

Please sign in to comment.