rubber 2.0.5 → 2.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -2
- data/CHANGELOG +50 -0
- data/lib/rubber/commands/cron.rb +9 -11
- data/lib/rubber/commands/util.rb +1 -0
- data/lib/rubber/dns.rb +29 -4
- data/lib/rubber/dns/aws.rb +181 -0
- data/lib/rubber/dns/nettica.rb +74 -36
- data/lib/rubber/dns/zerigo.rb +110 -4
- data/lib/rubber/instance.rb +1 -1
- data/lib/rubber/recipes/rubber/instances.rb +13 -5
- data/lib/rubber/recipes/rubber/security_groups.rb +1 -1
- data/lib/rubber/recipes/rubber/setup.rb +80 -64
- data/lib/rubber/util.rb +7 -0
- data/lib/rubber/version.rb +1 -1
- data/templates/base/config/rubber/deploy-setup.rb +12 -0
- data/templates/base/config/rubber/rubber-dns.yml +17 -21
- data/templates/base/config/rubber/rubber.yml +2 -2
- data/templates/collectd/config/rubber/role/passenger/passenger-status-sudoers.conf +1 -1
- data/templates/elasticsearch/config/rubber/rubber-elasticsearch.yml +1 -1
- data/templates/graphite/config/rubber/role/graphite_web/dashboard.html +5 -3
- data/templates/jenkins/config/environments/jenkins.rb +1 -1
- data/templates/jenkins/config/rubber/rubber-jenkins.yml +1 -1
- data/templates/passenger/config/rubber/deploy-passenger.rb +0 -8
- data/templates/postgresql/config/rubber/rubber-postgresql.yml +2 -2
- data/templates/resque/config/initializers/resque.rb +2 -2
- data/templates/resque/config/resque.yml +4 -0
- data/templates/resque/config/rubber/common/resque.yml +1 -1
- data/templates/resque_scheduler/config/rubber/common/resque_schedule.yml +9 -0
- data/templates/resque_scheduler/config/rubber/deploy-resque_scheduler.rb +38 -0
- data/templates/resque_scheduler/config/rubber/role/resque_scheduler/resque-scheduler-upstart.conf +20 -0
- data/templates/resque_scheduler/config/rubber/rubber-resque_scheduler.yml +7 -0
- data/templates/resque_scheduler/lib/tasks/resque-scheduler.rake +28 -0
- data/templates/resque_scheduler/templates.rb +1 -0
- data/templates/resque_scheduler/templates.yml +3 -0
- data/templates/torquebox/config/rubber/rubber-torquebox.yml +1 -1
- data/templates/zookeeper/config/rubber/role/zookeeper/myid.conf +5 -4
- data/templates/zookeeper/config/rubber/role/zookeeper/zoo.cfg +6 -1
- data/test/command_test.rb +0 -55
- data/test/commands/cron_test.rb +83 -0
- data/test/dns/aws_test.rb +192 -0
- data/test/dns/zerigo_test.rb +180 -0
- data/test/instance_test.rb +17 -2
- data/test/test_helper.rb +37 -2
- metadata +20 -8
- data/lib/rubber/dns/fog.rb +0 -219
- data/test/dns/fog_test.rb +0 -169
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capistrano
|
@@ -245,9 +245,9 @@ files:
|
|
245
245
|
- lib/rubber/commands/vulcanize.rb
|
246
246
|
- lib/rubber/configuration.rb
|
247
247
|
- lib/rubber/dns.rb
|
248
|
+
- lib/rubber/dns/aws.rb
|
248
249
|
- lib/rubber/dns/base.rb
|
249
250
|
- lib/rubber/dns/dyndns.rb
|
250
|
-
- lib/rubber/dns/fog.rb
|
251
251
|
- lib/rubber/dns/nettica.rb
|
252
252
|
- lib/rubber/dns/zerigo.rb
|
253
253
|
- lib/rubber/environment.rb
|
@@ -545,6 +545,7 @@ files:
|
|
545
545
|
- templates/resque/config/initializers/resque.rb
|
546
546
|
- templates/resque/config/resque-pool.yml
|
547
547
|
- templates/resque/config/resque-web.ru
|
548
|
+
- templates/resque/config/resque.yml
|
548
549
|
- templates/resque/config/rubber/common/resque.yml
|
549
550
|
- templates/resque/config/rubber/deploy-resque.rb
|
550
551
|
- templates/resque/config/rubber/role/resque_web/resque-web-upstart.conf
|
@@ -554,6 +555,13 @@ files:
|
|
554
555
|
- templates/resque/lib/tasks/resque.rake
|
555
556
|
- templates/resque/templates.rb
|
556
557
|
- templates/resque/templates.yml
|
558
|
+
- templates/resque_scheduler/config/rubber/common/resque_schedule.yml
|
559
|
+
- templates/resque_scheduler/config/rubber/deploy-resque_scheduler.rb
|
560
|
+
- templates/resque_scheduler/config/rubber/role/resque_scheduler/resque-scheduler-upstart.conf
|
561
|
+
- templates/resque_scheduler/config/rubber/rubber-resque_scheduler.yml
|
562
|
+
- templates/resque_scheduler/lib/tasks/resque-scheduler.rake
|
563
|
+
- templates/resque_scheduler/templates.rb
|
564
|
+
- templates/resque_scheduler/templates.yml
|
557
565
|
- templates/sphinx/config/rubber/common/sphinx.yml
|
558
566
|
- templates/sphinx/config/rubber/deploy-sphinx.rb
|
559
567
|
- templates/sphinx/config/rubber/role/sphinx/crontab
|
@@ -595,7 +603,9 @@ files:
|
|
595
603
|
- test/cloud/fog_storage_test.rb
|
596
604
|
- test/cloud/fog_test.rb
|
597
605
|
- test/command_test.rb
|
598
|
-
- test/
|
606
|
+
- test/commands/cron_test.rb
|
607
|
+
- test/dns/aws_test.rb
|
608
|
+
- test/dns/zerigo_test.rb
|
599
609
|
- test/environment_test.rb
|
600
610
|
- test/fixtures/basic/common/bar.conf
|
601
611
|
- test/fixtures/basic/common/foo.conf
|
@@ -638,7 +648,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
638
648
|
version: '0'
|
639
649
|
segments:
|
640
650
|
- 0
|
641
|
-
hash:
|
651
|
+
hash: -4247981851858635399
|
642
652
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
643
653
|
none: false
|
644
654
|
requirements:
|
@@ -647,10 +657,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
647
657
|
version: '0'
|
648
658
|
segments:
|
649
659
|
- 0
|
650
|
-
hash:
|
660
|
+
hash: -4247981851858635399
|
651
661
|
requirements: []
|
652
662
|
rubyforge_project: rubber
|
653
|
-
rubygems_version: 1.8.
|
663
|
+
rubygems_version: 1.8.24
|
654
664
|
signing_key:
|
655
665
|
specification_version: 3
|
656
666
|
summary: A capistrano plugin for managing multi-instance deployments to the cloud
|
@@ -661,7 +671,9 @@ test_files:
|
|
661
671
|
- test/cloud/fog_storage_test.rb
|
662
672
|
- test/cloud/fog_test.rb
|
663
673
|
- test/command_test.rb
|
664
|
-
- test/
|
674
|
+
- test/commands/cron_test.rb
|
675
|
+
- test/dns/aws_test.rb
|
676
|
+
- test/dns/zerigo_test.rb
|
665
677
|
- test/environment_test.rb
|
666
678
|
- test/fixtures/basic/common/bar.conf
|
667
679
|
- test/fixtures/basic/common/foo.conf
|
data/lib/rubber/dns/fog.rb
DELETED
@@ -1,219 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'fog'
|
3
|
-
|
4
|
-
module Rubber
|
5
|
-
module Dns
|
6
|
-
|
7
|
-
class Fog < Base
|
8
|
-
|
9
|
-
attr_accessor :client
|
10
|
-
|
11
|
-
def initialize(env)
|
12
|
-
super(env)
|
13
|
-
creds = Rubber::Util.symbolize_keys(env.credentials)
|
14
|
-
@client = ::Fog::DNS.new(creds)
|
15
|
-
if creds[:provider] == 'aws'
|
16
|
-
@name_includes_domain = true
|
17
|
-
@name_includes_trailing_period = true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def normalize_name(name, domain)
|
22
|
-
domain = domain.gsub(/\.$/, "") if @name_includes_trailing_period
|
23
|
-
|
24
|
-
name = name.gsub(/\.$/, "") if @name_includes_trailing_period
|
25
|
-
name = name.gsub(/.?#{domain}$/, "") if @name_includes_domain
|
26
|
-
|
27
|
-
return name, domain
|
28
|
-
end
|
29
|
-
|
30
|
-
def denormalize_name(name, domain)
|
31
|
-
if @name_includes_domain
|
32
|
-
if name && name.strip.empty?
|
33
|
-
name = "#{domain}"
|
34
|
-
else
|
35
|
-
name = "#{name}.#{domain}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
if @name_includes_trailing_period
|
40
|
-
name = "#{name}."
|
41
|
-
domain = "#{domain}."
|
42
|
-
end
|
43
|
-
|
44
|
-
return name, domain
|
45
|
-
end
|
46
|
-
|
47
|
-
def host_to_opts(host)
|
48
|
-
name, domain = normalize_name(host.name || '', host.zone.domain)
|
49
|
-
opts = {}
|
50
|
-
opts[:id] = host.id if host.respond_to?(:id) && host.id
|
51
|
-
opts[:host] = fix_hostname(name)
|
52
|
-
opts[:domain] = domain
|
53
|
-
opts[:type] = host.type
|
54
|
-
opts[:ttl] = host.ttl.to_i if host.ttl
|
55
|
-
opts[:priority] = host.priority if host.respond_to?(:priority) && host.priority
|
56
|
-
|
57
|
-
if host.respond_to?(:alias_target) && ! host.alias_target.nil?
|
58
|
-
|
59
|
-
# Convert from camel-case to snake-case for Route 53 ALIAS records so the match the rubber config format.
|
60
|
-
opts[:data] = {
|
61
|
-
'hosted_zone_id' => host.alias_target['HostedZoneId'],
|
62
|
-
'dns_name' => host.alias_target['DNSName'].split('.')[0..-1].join('.')
|
63
|
-
}
|
64
|
-
|
65
|
-
# Route 53 ALIAS records do not have a TTL, so delete the rubber-supplied default value.
|
66
|
-
opts.delete(:ttl)
|
67
|
-
else
|
68
|
-
opts[:data] = Array(host.value).first if host.value
|
69
|
-
end
|
70
|
-
|
71
|
-
return opts
|
72
|
-
end
|
73
|
-
|
74
|
-
def opts_to_host(opts, host={})
|
75
|
-
name, domain = denormalize_name(opts[:host], opts[:domain])
|
76
|
-
|
77
|
-
host[:name] = name
|
78
|
-
host[:type] = opts[:type]
|
79
|
-
host[:ttl] = opts[:ttl] if opts[:ttl]
|
80
|
-
host[:priority] = opts[:priority] if opts[:priority]
|
81
|
-
|
82
|
-
if opts[:data]
|
83
|
-
creds = Rubber::Util.symbolize_keys(env.credentials)
|
84
|
-
|
85
|
-
if creds[:provider] == 'aws'
|
86
|
-
# Route 53 requires the priority to be munged with the data value.
|
87
|
-
if opts[:type] =~ /MX/i
|
88
|
-
host[:value] = "#{opts[:priority]} #{opts[:data]}"
|
89
|
-
else
|
90
|
-
# Route 53 allows creation of ALIAS records, which will always be a Hash in the DNS config. ALIAS records
|
91
|
-
# cannot have a TTL.
|
92
|
-
if opts[:data].is_a?(Hash)
|
93
|
-
host[:alias_target] = opts[:data]
|
94
|
-
host.delete(:ttl)
|
95
|
-
else
|
96
|
-
host[:value] = opts[:data]
|
97
|
-
end
|
98
|
-
end
|
99
|
-
else
|
100
|
-
host[:value] = opts[:data]
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
return host
|
105
|
-
end
|
106
|
-
|
107
|
-
def find_or_create_zone(domain)
|
108
|
-
zone = @client.zones.all.find {|z| z.domain =~ /^#{domain}\.?/}
|
109
|
-
if ! zone
|
110
|
-
zone = @client.zones.create(:domain => domain)
|
111
|
-
end
|
112
|
-
return zone
|
113
|
-
end
|
114
|
-
|
115
|
-
def find_hosts(opts = {})
|
116
|
-
opts = setup_opts(opts, [:host, :domain])
|
117
|
-
result = []
|
118
|
-
zone = find_or_create_zone(opts[:domain])
|
119
|
-
|
120
|
-
host_type = opts[:type]
|
121
|
-
host_data = opts[:data]
|
122
|
-
|
123
|
-
fqdn = nil
|
124
|
-
if opts.has_key?(:host) && opts[:host] != '*'
|
125
|
-
hostname = opts[:host]
|
126
|
-
hostname = nil if hostname && hostname.strip.empty?
|
127
|
-
|
128
|
-
fqdn = ""
|
129
|
-
fqdn << "#{hostname}." if hostname
|
130
|
-
fqdn << "#{opts[:domain]}"
|
131
|
-
end
|
132
|
-
|
133
|
-
# TODO: revert this when fog gets fixed
|
134
|
-
# hosts = fqdn ? (zone.records.all(:name => fqdn) rescue []) : zone.records.all
|
135
|
-
hosts = zone.records.all
|
136
|
-
if fqdn
|
137
|
-
hosts = hosts.find_all do |r|
|
138
|
-
attributes = host_to_opts(r)
|
139
|
-
|
140
|
-
# Route 53 encodes the asterisk character ('*') as octal. Translate it here so rubber is consistent.
|
141
|
-
host, domain = fix_hostname(attributes[:host]), attributes[:domain]
|
142
|
-
|
143
|
-
fog_fqdn = ""
|
144
|
-
fog_fqdn << "#{host}." if host && ! host.strip.empty?
|
145
|
-
fog_fqdn << "#{domain}"
|
146
|
-
|
147
|
-
fqdn == fog_fqdn
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
hosts.each do |h|
|
152
|
-
keep = true
|
153
|
-
attributes = host_to_opts(h)
|
154
|
-
|
155
|
-
if host_type && host_type != '*' && attributes[:type] != host_type
|
156
|
-
keep = false
|
157
|
-
end
|
158
|
-
|
159
|
-
if host_data && attributes[:data] != host_data
|
160
|
-
keep = false
|
161
|
-
end
|
162
|
-
|
163
|
-
result << h if keep
|
164
|
-
end
|
165
|
-
|
166
|
-
result
|
167
|
-
end
|
168
|
-
|
169
|
-
def find_host_records(opts = {})
|
170
|
-
hosts = find_hosts(opts)
|
171
|
-
result = hosts.collect {|h| host_to_opts(h).merge(:domain => opts[:domain]) }
|
172
|
-
return result
|
173
|
-
end
|
174
|
-
|
175
|
-
def create_host_record(opts = {})
|
176
|
-
opts = setup_opts(opts, [:host, :data, :domain, :type, :ttl])
|
177
|
-
zone = find_or_create_zone(opts[:domain])
|
178
|
-
zone.records.create(opts_to_host(opts))
|
179
|
-
end
|
180
|
-
|
181
|
-
def destroy_host_record(opts = {})
|
182
|
-
opts = setup_opts(opts, [:host, :domain])
|
183
|
-
|
184
|
-
find_hosts(opts).each do |h|
|
185
|
-
h.destroy || raise("Failed to destroy #{h.hostname}")
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
def update_host_record(old_opts={}, new_opts={})
|
190
|
-
old_opts = setup_opts(old_opts, [:host, :domain])
|
191
|
-
new_opts = setup_opts(new_opts, [:host, :domain, :type, :data])
|
192
|
-
|
193
|
-
find_hosts(old_opts).each do |h|
|
194
|
-
changes = opts_to_host(new_opts)
|
195
|
-
result = nil
|
196
|
-
if h.respond_to?(:modify)
|
197
|
-
result = h.modify(changes)
|
198
|
-
elsif h.respond_to?(:update_host)
|
199
|
-
result = h.update_host(changes)
|
200
|
-
else
|
201
|
-
changes.each do |k, v|
|
202
|
-
h.send("#{k}=", v)
|
203
|
-
end
|
204
|
-
result = h.save
|
205
|
-
end
|
206
|
-
|
207
|
-
result || raise("Failed to update host #{h.hostname}, #{h.errors.full_messages.join(', ')}")
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
def fix_hostname(host)
|
212
|
-
# Route 53 encodes asterisks in their ASCII octal representation.
|
213
|
-
host.gsub("\\052", "*")
|
214
|
-
end
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
|
-
end
|
219
|
-
end
|
data/test/dns/fog_test.rb
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(__FILE__, '../..', 'test_helper'))
|
2
|
-
require 'rubber/dns/fog'
|
3
|
-
|
4
|
-
class FogTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
@envs = []
|
7
|
-
|
8
|
-
env = {'credentials' =>
|
9
|
-
{'provider' => 'zerigo', 'zerigo_email' => 'xxx', 'zerigo_token' => 'yyy'}}
|
10
|
-
@envs << Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil)
|
11
|
-
|
12
|
-
unless ENV['CI']
|
13
|
-
secret = YAML.load_file(File.expand_path("~/rubber-secret.yml")) rescue {}
|
14
|
-
access_key = secret['cloud_providers']['aws']['access_key']
|
15
|
-
access_secret = secret['cloud_providers']['aws']['secret_access_key']
|
16
|
-
env = {'credentials' =>
|
17
|
-
{'provider' => 'aws', 'aws_access_key_id' => access_key, 'aws_secret_access_key' => access_secret}}
|
18
|
-
# no mocks for aws dns yet
|
19
|
-
@envs << Rubber::Configuration::Environment::BoundEnv.new(env, nil, nil)
|
20
|
-
end
|
21
|
-
|
22
|
-
def all_test_zones(dns=@dns)
|
23
|
-
dns.client.zones.all.find_all {|z| z.domain =~ /rubbertest/ }
|
24
|
-
end
|
25
|
-
|
26
|
-
def destroy_test_domains
|
27
|
-
all_test_zones(Rubber::Dns::Fog.new(@env)).each do |zone|
|
28
|
-
zone.records.all.each do |record|
|
29
|
-
record.destroy
|
30
|
-
end
|
31
|
-
zone.destroy
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
env = @envs.first
|
36
|
-
@envs.each do |env|
|
37
|
-
|
38
|
-
context "fog #{env.credentials.provider} dns" do
|
39
|
-
|
40
|
-
setup do
|
41
|
-
@env = env
|
42
|
-
|
43
|
-
# no mocks for aws dns yet
|
44
|
-
if env.credentials.provider == 'aws'
|
45
|
-
Fog.unmock!
|
46
|
-
destroy_test_domains
|
47
|
-
end
|
48
|
-
|
49
|
-
@dns = Rubber::Dns::Fog.new(@env)
|
50
|
-
end
|
51
|
-
|
52
|
-
context "find_or_create" do
|
53
|
-
|
54
|
-
should "create domain if it doesn't exist" do
|
55
|
-
assert_equal 0, all_test_zones.size
|
56
|
-
|
57
|
-
zone0 = @dns.find_or_create_zone("rubbertest.com")
|
58
|
-
|
59
|
-
assert_equal 1, all_test_zones.size
|
60
|
-
zone1 = all_test_zones.find {|z| z.domain =~ /^rubbertest.com/ }
|
61
|
-
assert zone1
|
62
|
-
assert_equal zone0.id, zone1.id
|
63
|
-
assert_equal zone0.domain, zone1.domain
|
64
|
-
end
|
65
|
-
|
66
|
-
should "match the same domain that was passed" do
|
67
|
-
assert_equal 0, all_test_zones.size
|
68
|
-
|
69
|
-
zone0 = @dns.find_or_create_zone("abcrubbertest.com")
|
70
|
-
zone1 = @dns.find_or_create_zone("rubbertest.com")
|
71
|
-
|
72
|
-
assert_equal 2, all_test_zones.size
|
73
|
-
|
74
|
-
zone2 = all_test_zones.find {|z| z.domain =~ /^rubbertest.com/ }
|
75
|
-
assert zone2
|
76
|
-
assert_equal zone1.id, zone2.id
|
77
|
-
assert_equal zone1.domain, zone2.domain
|
78
|
-
end
|
79
|
-
|
80
|
-
should "do nothing if domain already exists" do
|
81
|
-
@dns.client.zones.create(:domain => 'rubbertest.com')
|
82
|
-
assert_equal 1, all_test_zones.size
|
83
|
-
|
84
|
-
zone0 = @dns.find_or_create_zone("rubbertest.com")
|
85
|
-
|
86
|
-
assert_equal 1, all_test_zones.size
|
87
|
-
zone1 = all_test_zones.find {|z| z.domain =~ /^rubbertest.com/ }
|
88
|
-
assert_equal zone0.id, zone1.id
|
89
|
-
assert_equal zone0.domain, zone1.domain
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
context "records" do
|
95
|
-
|
96
|
-
setup do
|
97
|
-
@domain = "rubbertest.com"
|
98
|
-
@zone = @dns.find_or_create_zone(@domain)
|
99
|
-
end
|
100
|
-
|
101
|
-
should "create_record" do
|
102
|
-
@dns.create_host_record({:host => 'newhost', :domain => @domain, :data => '1.1.1.1', :type => 'A', :ttl => '333'})
|
103
|
-
|
104
|
-
assert_equal @zone.records.all.size, 1
|
105
|
-
record = @zone.records.first
|
106
|
-
attributes = @dns.host_to_opts(record)
|
107
|
-
|
108
|
-
assert_equal 'newhost', attributes[:host]
|
109
|
-
assert_equal @domain, attributes[:domain]
|
110
|
-
assert_equal '1.1.1.1', attributes[:data]
|
111
|
-
assert_equal 'A', attributes[:type]
|
112
|
-
assert_equal 333, attributes[:ttl]
|
113
|
-
end
|
114
|
-
|
115
|
-
should "destroy_record" do
|
116
|
-
# Create the record we want to test destroying.
|
117
|
-
@dns.create_host_record({:host => 'newhost', :domain => @domain, :data => '1.1.1.1', :type => 'A'})
|
118
|
-
assert_equal 1, @zone.records.all.size
|
119
|
-
|
120
|
-
@dns.destroy_host_record({:host => 'newhost', :domain => @domain})
|
121
|
-
|
122
|
-
assert_equal 0, @zone.records.all.size
|
123
|
-
end
|
124
|
-
|
125
|
-
should "update_record" do
|
126
|
-
params = {:host => 'host1', :domain => @domain, :data => "1.1.1.1"}
|
127
|
-
new = {:host => 'host1', :domain => @domain, :data => "1.1.1.2"}
|
128
|
-
|
129
|
-
@dns.create_host_record({:host => 'host1', :domain => @domain, :data => '1.1.1.1', :type => 'A'})
|
130
|
-
assert_equal 1, @zone.records.all.size
|
131
|
-
|
132
|
-
@dns.update_host_record(params, new)
|
133
|
-
assert_equal 1, @zone.records.all.size
|
134
|
-
|
135
|
-
record = @zone.records.all.first
|
136
|
-
attributes = @dns.host_to_opts(record)
|
137
|
-
assert_equal '1.1.1.2', attributes[:data]
|
138
|
-
end
|
139
|
-
|
140
|
-
should "find_records" do
|
141
|
-
# Set up some sample records.
|
142
|
-
created = []
|
143
|
-
created << {:host => 'host1', :domain => @domain, :data => '1.1.1.1', :type => 'A'}
|
144
|
-
created << {:host => '', :domain => @domain, :data => '1.1.1.1', :type => 'A'}
|
145
|
-
created.each {|r| @dns.create_host_record(r) }
|
146
|
-
|
147
|
-
# Search for records through the rubber DNS interface and make sure whe get what we expected.
|
148
|
-
|
149
|
-
# Wildcard search.
|
150
|
-
records = @dns.find_host_records(:host => '*', :domain => @domain)
|
151
|
-
assert_equal 2, records.size
|
152
|
-
|
153
|
-
# Blank hostname search.
|
154
|
-
records = @dns.find_host_records(:host => '', :domain => @domain)
|
155
|
-
assert_equal 1, records.size
|
156
|
-
assert_equal '', records.first[:host]
|
157
|
-
|
158
|
-
# Specific hostname search.
|
159
|
-
records = @dns.find_host_records(:host => 'host1', :domain => @domain)
|
160
|
-
assert_equal 1, records.size
|
161
|
-
assert_equal 'host1', records.first[:host]
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
165
|
-
|
166
|
-
end
|
167
|
-
|
168
|
-
end
|
169
|
-
end
|