Skip to content

Commit

Permalink
Merge pull request #15 from rightscale-cookbooks/st_14_15_acu182511_v…
Browse files Browse the repository at this point in the history
…alidate_ip_before_setting_tag

St 14 15 acu182511 validate ip before setting tag
  • Loading branch information
douglaswth committed Oct 28, 2014
2 parents af0fa6f + 6b60e1f commit 5a107d7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 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.4
------

- Check IP addresses if they are private IPs before setting server:public_ip_# and server:private_ip_#.

v1.0.3
------

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ type. To use them in a recipe add the following:

```ruby
class Chef::Recipe
include RightScale::RightScaleTag
include Rightscale::RightscaleTag
end
```

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.3'
version '1.0.4'

depends 'machine_tag', '~> 1.0.3'
depends 'marker', '~> 1.0.0'
Expand Down
4 changes: 2 additions & 2 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@

if node['cloud']
if node['cloud']['public_ips']
node['cloud']['public_ips'].reject { |ip| ip.nil? || ip.empty? }.each_with_index do |public_ip, index|
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? }.each_with_index do |private_ip, index|
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
Expand Down

0 comments on commit 5a107d7

Please sign in to comment.