Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
Only create a CNAME if node[cloud_v2] is not nil
Browse files Browse the repository at this point in the history
When nodes are running in VPC, ohai will set `cloud_v2` to nil. Since VPC nodes don't have public CNAME's (only a public IP), ultimately we'll need to create A-records.
  • Loading branch information
Sam Kottler committed Jul 3, 2014
1 parent 6c9377c commit 2e37b7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Berksfile.lock
Expand Up @@ -239,7 +239,7 @@ GRAPH
rubygems-backups (>= 0.0.0)
rubygems-fail2ban (0.0.2)
fail2ban (>= 0.0.0)
rubygems-hostname (0.1.6)
rubygems-hostname (0.1.9)
chef-vault (>= 0.0.0)
dwradcliffe-dnsimple (>= 0.0.0)
hostname (>= 0.0.0)
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/rubygems-hostname/metadata.rb
Expand Up @@ -2,7 +2,7 @@
maintainer 'RubyGems.org Ops Team'
license 'MIT'
description 'Set the hostname of RubyGems.org machines using node.name'
version '0.1.6'
version '0.1.9'

depends 'chef-vault'
depends 'dwradcliffe-dnsimple'
Expand Down
18 changes: 10 additions & 8 deletions cookbooks/rubygems-hostname/recipes/dns.rb
Expand Up @@ -9,12 +9,14 @@

include_recipe 'dwradcliffe-dnsimple'

dwradcliffe_dnsimple_record "create a CNAME record for #{node.name}" do
name node.name.sub('.rubygems.org', '')
content node['cloud_v2']['public_hostname']
type 'CNAME'
domain 'rubygems.org'
username dnsimple_credentials['username']
password dnsimple_credentials['password']
action :create
if node['cloud_v2']
dwradcliffe_dnsimple_record "create a CNAME record for #{node.name}" do
name node.name.sub('.rubygems.org', '')
content node['cloud_v2']['public_hostname']
type 'CNAME'
domain 'rubygems.org'
username dnsimple_credentials['username']
password dnsimple_credentials['password']
action :create
end
end

0 comments on commit 2e37b7d

Please sign in to comment.