rubber 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/VERSION +1 -1
- data/generators/vulcanize/templates/apache/config/rubber/deploy-apache.rb +4 -4
- data/generators/vulcanize/templates/base/config/rubber/deploy-setup.rb +4 -4
- data/generators/vulcanize/templates/base/config/rubber/rubber-dns.yml +0 -1
- data/generators/vulcanize/templates/base/config/rubber/rubber.yml +4 -4
- data/generators/vulcanize/templates/complete_mongrel_mysql/config/rubber/role/haproxy/haproxy-mongrel.conf +2 -2
- data/generators/vulcanize/templates/complete_passenger_mysql/config/rubber/role/haproxy/haproxy-passenger.conf +1 -1
- data/generators/vulcanize/templates/cruise/config/rubber/deploy-cruise.rb +2 -2
- data/generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb +4 -4
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslog-haproxy.conf +8 -3
- data/generators/vulcanize/templates/haproxy/config/rubber/role/haproxy/syslogd-default.conf +4 -0
- data/generators/vulcanize/templates/jetty/config/rubber/deploy-jetty.rb +4 -4
- data/generators/vulcanize/templates/mongrel/config/rubber/deploy-mongrel.rb +4 -4
- data/generators/vulcanize/templates/monit/config/rubber/common/monit.conf +0 -1
- data/generators/vulcanize/templates/monit/config/rubber/deploy-monit.rb +4 -3
- data/generators/vulcanize/templates/munin/config/rubber/deploy-munin.rb +3 -3
- data/generators/vulcanize/templates/munin/config/rubber/role/web_tools/munin-plugins.conf +1 -1
- data/generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb +106 -8
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf +46 -0
- data/generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf +2 -6
- data/generators/vulcanize/templates/mysql/config/rubber/rubber-mysql.yml +1 -1
- data/generators/vulcanize/templates/nginx/config/rubber/deploy-nginx.rb +4 -4
- data/generators/vulcanize/templates/passenger/config/rubber/deploy-passenger.rb +1 -1
- data/generators/vulcanize/templates/passenger/config/rubber/rubber-passenger.yml +1 -1
- data/generators/vulcanize/templates/redis/config/rubber/deploy-redis.rb +5 -5
- data/generators/vulcanize/templates/resque/config/rubber/deploy-resque.rb +1 -1
- data/generators/vulcanize/templates/sphinx/config/rubber/deploy-sphinx.rb +7 -6
- data/lib/rubber/dns/zerigo.rb +59 -124
- data/lib/rubber/environment.rb +5 -5
- data/lib/rubber/generator.rb +29 -21
- data/lib/rubber/recipes/rubber/deploy.rb +2 -2
- data/lib/rubber/recipes/rubber/instances.rb +3 -0
- data/lib/rubber/recipes/rubber/setup.rb +74 -46
- data/lib/rubber/recipes/rubber/utils.rb +2 -2
- data/lib/rubber/recipes/rubber/volumes.rb +4 -4
- data/test/generator_test.rb +44 -0
- data/test/test_helper.rb +6 -0
- data/test/zerigo_test.rb +87 -0
- metadata +20 -6
@@ -59,8 +59,8 @@ namespace :rubber do
|
|
59
59
|
Sets permissions of files in application directory to be owned by app_user.
|
60
60
|
DESC
|
61
61
|
task :setup_app_permissions do
|
62
|
-
|
63
|
-
|
62
|
+
sudo "sh -c 'find #{shared_path} -name cached-copy -prune -o -print | xargs chown #{rubber_env.app_user}:#{rubber_env.app_user}'"
|
63
|
+
sudo "chown -R #{rubber_env.app_user}:#{rubber_env.app_user} #{current_path}/tmp"
|
64
64
|
end
|
65
65
|
|
66
66
|
def run_config(options={})
|
@@ -228,6 +228,9 @@ namespace :rubber do
|
|
228
228
|
instance_item.platform = instance[:platform]
|
229
229
|
rubber_instances.save()
|
230
230
|
|
231
|
+
# turn back on root ssh access if we are using root as the capistrano user for connecting
|
232
|
+
enable_root_ssh(instance_item.external_ip, fetch(:initial_ssh_user, 'ubuntu')) if user == 'root'
|
233
|
+
|
231
234
|
# setup amazon elastic ips if configured to do so
|
232
235
|
setup_static_ips
|
233
236
|
|
@@ -7,8 +7,8 @@ namespace :rubber do
|
|
7
7
|
Bootstraps instances by setting timezone, installing packages and gems
|
8
8
|
DESC
|
9
9
|
task :bootstrap do
|
10
|
-
set_timezone
|
11
10
|
link_bash
|
11
|
+
set_timezone
|
12
12
|
upgrade_packages
|
13
13
|
install_packages
|
14
14
|
setup_volumes
|
@@ -17,6 +17,33 @@ namespace :rubber do
|
|
17
17
|
deploy.setup
|
18
18
|
end
|
19
19
|
|
20
|
+
# Sets up instance to allow root access (e.g. recent canonical AMIs)
|
21
|
+
def enable_root_ssh(ip, initial_ssh_user)
|
22
|
+
old_user = user
|
23
|
+
begin
|
24
|
+
set :user, initial_ssh_user
|
25
|
+
|
26
|
+
task :_allow_root_ssh, :hosts => ip do
|
27
|
+
sudo "cp /home/#{initial_ssh_user}/.ssh/authorized_keys /root/.ssh/"
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
_allow_root_ssh
|
32
|
+
rescue ConnectionError => e
|
33
|
+
if e.message =~ /Net::SSH::AuthenticationFailed/
|
34
|
+
logger.info "Can't connect as user #{initial_ssh_user} to #{ip}, assuming root allowed"
|
35
|
+
else
|
36
|
+
sleep 2
|
37
|
+
logger.info "Failed to connect to #{ip}, retrying"
|
38
|
+
retry
|
39
|
+
end
|
40
|
+
end
|
41
|
+
ensure
|
42
|
+
set :user, old_user
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
20
47
|
desc <<-DESC
|
21
48
|
Sets up aliases for instance hostnames based on contents of instance.yml.
|
22
49
|
Generates /etc/hosts for local/remote machines and sets hostname on
|
@@ -167,7 +194,9 @@ namespace :rubber do
|
|
167
194
|
put filtered, hosts_file
|
168
195
|
|
169
196
|
# Setup hostname on instance so shell, etcs have nice display
|
170
|
-
sudo "echo $CAPISTRANO:HOST$ > /etc/hostname && hostname $CAPISTRANO:HOST$"
|
197
|
+
sudo "sh -c 'echo $CAPISTRANO:HOST$ > /etc/hostname && hostname $CAPISTRANO:HOST$'"
|
198
|
+
# Newer ubuntus ec2-init script always resets hostname, so prevent it
|
199
|
+
sudo "sh -c 'echo compat=0 > /etc/ec2-init/is-compat-env'"
|
171
200
|
end
|
172
201
|
|
173
202
|
# TODO
|
@@ -248,46 +277,43 @@ namespace :rubber do
|
|
248
277
|
|
249
278
|
logger.info "Installing gems:#{expanded_gem_list}"
|
250
279
|
open("/tmp/gem_helper", "w") {|f| f.write(gem_helper_script)}
|
251
|
-
system "
|
280
|
+
system "ruby /tmp/gem_helper install #{expanded_gem_list}"
|
252
281
|
end
|
253
282
|
|
283
|
+
set :gem_sources_helper_script, <<-'ENDSCRIPT'
|
284
|
+
sources = ARGV
|
285
|
+
|
286
|
+
installed = []
|
287
|
+
`gem sources -l`.each_line do |line|
|
288
|
+
line = line.strip
|
289
|
+
installed << line if line.size > 0 && line =~ /^[^*]/
|
290
|
+
end
|
291
|
+
|
292
|
+
to_install = sources - installed
|
293
|
+
to_remove = installed - sources
|
294
|
+
|
295
|
+
if to_install.size > 0
|
296
|
+
to_install.each do |source|
|
297
|
+
system "gem sources -a #{source}"
|
298
|
+
fail "Unable to add gem sources" if $?.exitstatus > 0
|
299
|
+
end
|
300
|
+
end
|
301
|
+
if to_remove.size > 0
|
302
|
+
to_remove.each do |source|
|
303
|
+
system "gem sources -r #{source}"
|
304
|
+
fail "Unable to remove gem sources" if $?.exitstatus > 0
|
305
|
+
end
|
306
|
+
end
|
307
|
+
ENDSCRIPT
|
308
|
+
|
254
309
|
desc <<-DESC
|
255
310
|
Setup ruby gems sources. Set 'gemsources' in rubber.yml to \
|
256
311
|
be an array of URI strings.
|
257
312
|
DESC
|
258
313
|
task :setup_gem_sources do
|
259
314
|
if rubber_env.gemsources
|
260
|
-
script = prepare_script 'gem_sources_helper',
|
261
|
-
|
262
|
-
|
263
|
-
sources = ARGV
|
264
|
-
|
265
|
-
installed = []
|
266
|
-
`gem sources -l`.grep(/^[^*]/) do |line|
|
267
|
-
line = line.strip
|
268
|
-
installed << line if line.size > 0
|
269
|
-
end
|
270
|
-
|
271
|
-
to_install = sources - installed
|
272
|
-
to_remove = installed - sources
|
273
|
-
|
274
|
-
if to_install.size > 0
|
275
|
-
to_install.each do |source|
|
276
|
-
system "gem sources -a #{source}"
|
277
|
-
fail "Unable to add gem sources" if $?.exitstatus > 0
|
278
|
-
end
|
279
|
-
end
|
280
|
-
if to_remove.size > 0
|
281
|
-
to_remove.each do |source|
|
282
|
-
system "gem sources -r #{source}"
|
283
|
-
fail "Unable to remove gem sources" if $?.exitstatus > 0
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
'EOF'
|
288
|
-
ENDSCRIPT
|
289
|
-
|
290
|
-
sudo "sh #{script} #{rubber_env.gemsources.join(' ')}"
|
315
|
+
script = prepare_script 'gem_sources_helper', gem_sources_helper_script, nil
|
316
|
+
sudo "ruby #{script} #{rubber_env.gemsources.join(' ')}"
|
291
317
|
end
|
292
318
|
end
|
293
319
|
|
@@ -296,7 +322,7 @@ namespace :rubber do
|
|
296
322
|
You can override this task if you don't want this to happen
|
297
323
|
DESC
|
298
324
|
task :link_bash do
|
299
|
-
sudo
|
325
|
+
sudo "ln -sf /bin/bash /bin/sh"
|
300
326
|
end
|
301
327
|
|
302
328
|
desc <<-DESC
|
@@ -310,10 +336,16 @@ namespace :rubber do
|
|
310
336
|
DESC
|
311
337
|
task :set_timezone do
|
312
338
|
opts = get_host_options('timezone')
|
313
|
-
sudo "
|
339
|
+
sudo "sh -c 'echo $CAPISTRANO:VAR$ > /etc/timezone'", opts
|
314
340
|
sudo "cp /usr/share/zoneinfo/$CAPISTRANO:VAR$ /etc/localtime", opts
|
315
341
|
# restart syslog so that times match timezone
|
316
|
-
|
342
|
+
sudo_script 'restart_syslog', <<-ENDSCRIPT
|
343
|
+
if [[ -x /etc/init.d/sysklogd ]]; then
|
344
|
+
/etc/init.d/sysklogd restart
|
345
|
+
elif [[ -x /etc/init.d/rsyslog ]]; then
|
346
|
+
/etc/init.d/rsyslog restart
|
347
|
+
fi
|
348
|
+
ENDSCRIPT
|
317
349
|
end
|
318
350
|
|
319
351
|
def update_dyndns(instance_item)
|
@@ -354,7 +386,7 @@ namespace :rubber do
|
|
354
386
|
end
|
355
387
|
|
356
388
|
def custom_package(url_base, name, ver, install_test)
|
357
|
-
rubber.
|
389
|
+
rubber.sudo_script "install_#{name}", <<-ENDSCRIPT
|
358
390
|
if [[ #{install_test} ]]; then
|
359
391
|
arch=`uname -m`
|
360
392
|
if [ "$arch" = "x86_64" ]; then
|
@@ -389,8 +421,6 @@ namespace :rubber do
|
|
389
421
|
# calls to rubygems
|
390
422
|
#
|
391
423
|
set :gem_helper_script, <<-'ENDSCRIPT'
|
392
|
-
ruby - $@ <<-'EOF'
|
393
|
-
|
394
424
|
gem_cmd = ARGV[0]
|
395
425
|
gems = ARGV[1..-1]
|
396
426
|
cmd = "gem #{gem_cmd} --no-rdoc --no-ri"
|
@@ -408,7 +438,7 @@ namespace :rubber do
|
|
408
438
|
end
|
409
439
|
|
410
440
|
installed = {}
|
411
|
-
`gem list --local`.
|
441
|
+
`gem list --local`.each_line do |line|
|
412
442
|
parts = line.scan(/(.*) \((.*)\)/).first
|
413
443
|
next unless parts && parts.size == 2
|
414
444
|
installed[parts[0]] = parts[1].split(",")
|
@@ -429,8 +459,6 @@ namespace :rubber do
|
|
429
459
|
system "#{cmd} #{gem_list}"
|
430
460
|
fail "Unable to install gems" if $?.exitstatus > 0
|
431
461
|
end
|
432
|
-
|
433
|
-
'EOF'
|
434
462
|
ENDSCRIPT
|
435
463
|
|
436
464
|
# Helper for installing gems,allows one to respond to prompts
|
@@ -450,11 +478,11 @@ namespace :rubber do
|
|
450
478
|
end
|
451
479
|
|
452
480
|
if opts.size > 0
|
453
|
-
script = prepare_script('gem_helper', gem_helper_script)
|
454
|
-
sudo "
|
481
|
+
script = prepare_script('gem_helper', gem_helper_script, nil)
|
482
|
+
sudo "ruby #{script} #{cmd} $CAPISTRANO:VAR$", opts do |ch, str, data|
|
455
483
|
handle_gem_prompt(ch, data, str)
|
456
484
|
end
|
457
485
|
end
|
458
486
|
end
|
459
487
|
|
460
|
-
end
|
488
|
+
end
|
@@ -147,10 +147,10 @@ namespace :rubber do
|
|
147
147
|
return local_alias
|
148
148
|
end
|
149
149
|
|
150
|
-
def prepare_script(name, contents)
|
150
|
+
def prepare_script(name, contents, stop_on_error_cmd=rubber_env.stop_on_error_cmd)
|
151
151
|
script = "/tmp/#{name}"
|
152
152
|
# this lets us abort a script if a command in the middle of it errors out
|
153
|
-
contents = "#{
|
153
|
+
contents = "#{stop_on_error_cmd}\n#{contents}" if stop_on_error_cmd
|
154
154
|
put(contents, script)
|
155
155
|
return script
|
156
156
|
end
|
@@ -104,7 +104,7 @@ namespace :rubber do
|
|
104
104
|
if vol_spec['mount'] && vol_spec['filesystem']
|
105
105
|
# then format/mount/etc if we don't have an entry in hosts file
|
106
106
|
task :_setup_volume, :hosts => ic.external_ip do
|
107
|
-
rubber.
|
107
|
+
rubber.sudo_script 'setup_volume', <<-ENDSCRIPT
|
108
108
|
if ! grep -q '#{vol_spec['mount']}' /etc/fstab; then
|
109
109
|
if mount | grep -q '#{vol_spec['mount']}'; then
|
110
110
|
umount '#{vol_spec['mount']}'
|
@@ -135,7 +135,7 @@ namespace :rubber do
|
|
135
135
|
if ! ic.partitions.include?(part_id)
|
136
136
|
# then format/mount/etc if we don't have an entry in hosts file
|
137
137
|
task :_setup_partition, :hosts => ic.external_ip do
|
138
|
-
rubber.
|
138
|
+
rubber.sudo_script 'setup_partition', <<-ENDSCRIPT
|
139
139
|
if ! fdisk -l 2>&1 | grep -q '#{partition_spec['partition_device']}'; then
|
140
140
|
if grep -q '#{partition_spec['disk_device']}\\b' /etc/fstab; then
|
141
141
|
umount #{partition_spec['disk_device']}
|
@@ -175,7 +175,7 @@ namespace :rubber do
|
|
175
175
|
end
|
176
176
|
# then format/mount/etc if we don't have an entry in hosts file
|
177
177
|
task :_zero_partitions, :hosts => ic.external_ip do
|
178
|
-
rubber.
|
178
|
+
rubber.sudo_script 'zero_partitions', <<-ENDSCRIPT
|
179
179
|
# zero out parition for performance (see amazon DevGuide)
|
180
180
|
echo "Zeroing out raid partitions to improve performance, this way take a while"
|
181
181
|
#{zero_script}
|
@@ -200,7 +200,7 @@ namespace :rubber do
|
|
200
200
|
end
|
201
201
|
|
202
202
|
task :_setup_raid_volume, :hosts => ic.external_ip do
|
203
|
-
rubber.
|
203
|
+
rubber.sudo_script 'setup_raid_volume', <<-ENDSCRIPT
|
204
204
|
if ! grep -q '#{raid_spec['device']}' /etc/fstab; then
|
205
205
|
if mount | grep -q '#{raid_spec['mount']}'; then
|
206
206
|
umount '#{raid_spec['mount']}'
|
data/test/generator_test.rb
CHANGED
@@ -93,6 +93,14 @@ class GeneratorTest < Test::Unit::TestCase
|
|
93
93
|
assert ! File.exists?(post_file), "post should not have been executed as dest file unchanged"
|
94
94
|
assert_equal "hello", File.read(out_file.path).strip, "transformed contents are incorrect"
|
95
95
|
|
96
|
+
FileUtils.rm_f(post_file)
|
97
|
+
gen = Generator.new(nil, nil, nil)
|
98
|
+
gen.force = true
|
99
|
+
gen.transform(src)
|
100
|
+
assert File.exists?(out_file.path), "transform did not generate an output file"
|
101
|
+
assert File.exists?(post_file), "forced transform did not execute post"
|
102
|
+
assert_equal "hello", File.read(out_file.path).strip, "transformed contents are incorrect"
|
103
|
+
|
96
104
|
FileUtils.rm_f(post_file)
|
97
105
|
gen = Generator.new(nil, nil, nil)
|
98
106
|
gen.no_post = true
|
@@ -323,4 +331,40 @@ def test_file_pattern
|
|
323
331
|
Generator.new(nil, nil, nil).transform(src)
|
324
332
|
assert ! File.exists?(out_file.path), "transform didn't skip generation of an output file"
|
325
333
|
end
|
334
|
+
|
335
|
+
def test_backup
|
336
|
+
out_file = Tempfile.new('testbak')
|
337
|
+
assert ! File.exists?("#{out_file.path}.bak")
|
338
|
+
File.open(out_file.path, 'w') {|f| f.write("howdy")}
|
339
|
+
|
340
|
+
src = <<-SRC
|
341
|
+
<%
|
342
|
+
@path = '#{out_file.path}'
|
343
|
+
%>
|
344
|
+
hello <%= Time.now.to_f %>
|
345
|
+
SRC
|
346
|
+
|
347
|
+
Generator.new(nil, nil, nil).transform(src)
|
348
|
+
|
349
|
+
assert File.exists?("#{out_file.path}.bak"), "transform didn't generate backup"
|
350
|
+
assert_match /howdy/, File.read("#{out_file.path}.bak"), "transform backup has wrong contents"
|
351
|
+
end
|
352
|
+
|
353
|
+
def test_no_backup
|
354
|
+
out_file = Tempfile.new('testnobak')
|
355
|
+
assert ! File.exists?("#{out_file.path}.bak")
|
356
|
+
File.open(out_file.path, 'w') {|f| f.write("howdy")}
|
357
|
+
src = <<-SRC
|
358
|
+
<%
|
359
|
+
@path = '#{out_file.path}'
|
360
|
+
@backup = false
|
361
|
+
%>
|
362
|
+
hello <%= Time.now.to_f %>
|
363
|
+
SRC
|
364
|
+
|
365
|
+
Generator.new(nil, nil, nil).transform(src)
|
366
|
+
|
367
|
+
assert ! File.exists?("#{out_file.path}.bak"), "transform shouldn't generate backup"
|
368
|
+
end
|
369
|
+
|
326
370
|
end
|
data/test/test_helper.rb
CHANGED
@@ -6,3 +6,9 @@ Rubber::initialize(File.dirname(__FILE__), 'test')
|
|
6
6
|
require 'rubygems'
|
7
7
|
require 'mocha'
|
8
8
|
require 'pp'
|
9
|
+
require 'fakeweb'
|
10
|
+
FakeWeb.allow_net_connect = false
|
11
|
+
|
12
|
+
def fakeweb_fixture(name)
|
13
|
+
return File.read("#{File.dirname(__FILE__)}/fixtures/fakeweb/#{name}")
|
14
|
+
end
|
data/test/zerigo_test.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'test-unit'
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
require 'test_helper'
|
6
|
+
require 'rubber/dns'
|
7
|
+
require 'rubber/dns/zerigo'
|
8
|
+
require 'rexml/document'
|
9
|
+
|
10
|
+
class ZerigoTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
env = Rubber::Configuration::Environment::BoundEnv.new({'dns_providers' => {'zerigo' => {'email' => 'foo@bar.com', 'token' => 'testtoken'}}}, nil, nil)
|
14
|
+
@dns = Rubber::Dns::Zerigo.new(env)
|
15
|
+
FakeWeb.register_uri(:get,
|
16
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/zones.xml",
|
17
|
+
:body => fakeweb_fixture('zerigo/get_zones.xml'))
|
18
|
+
@domain = "example1.com"
|
19
|
+
@zone = ::Zerigo::DNS::Zone.find_or_create(@domain)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_find_records
|
23
|
+
hosts_xml = fakeweb_fixture('zerigo/get_hosts.xml')
|
24
|
+
FakeWeb.register_uri(:get,
|
25
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts.xml?zone_id=1",
|
26
|
+
:body => hosts_xml)
|
27
|
+
records = @dns.find_host_records(:host => '*', :domain => 'example1.com')
|
28
|
+
assert_equal 2, records.size
|
29
|
+
assert_equal({:type=>"A", :host=>"host1", :domain=>"example1.com", :id=>1, :data=>"172.16.16.1"}, records.first)
|
30
|
+
|
31
|
+
doc = REXML::Document.new(hosts_xml)
|
32
|
+
doc.root.elements.delete(1)
|
33
|
+
hosts_xml_single = doc.to_s
|
34
|
+
FakeWeb.register_uri(:get,
|
35
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts.xml?fqdn=example1.com&zone_id=1",
|
36
|
+
:body => hosts_xml_single)
|
37
|
+
records = @dns.find_host_records(:host => '', :domain => 'example1.com')
|
38
|
+
assert_equal 1, records.size
|
39
|
+
assert_equal '', records.first[:host]
|
40
|
+
|
41
|
+
doc = REXML::Document.new(hosts_xml)
|
42
|
+
doc.root.elements.delete(2)
|
43
|
+
hosts_xml_single = doc.to_s
|
44
|
+
FakeWeb.register_uri(:get,
|
45
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts.xml?fqdn=host1.example1.com&zone_id=1",
|
46
|
+
:body => hosts_xml_single)
|
47
|
+
records = @dns.find_host_records(:host => 'host1', :domain => 'example1.com')
|
48
|
+
assert_equal 1, records.size
|
49
|
+
assert_equal 'host1', records.first[:host]
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_create_record
|
53
|
+
params = {:host => 'newhost', :domain => 'example1.com', :data => '1.1.1.1', :type => 'A', :ttl => '333'}
|
54
|
+
dest_params = {'hostname' => 'newhost', 'data' => '1.1.1.1', 'host_type' => 'A', 'ttl' => '333', :zone_id => @zone.id}
|
55
|
+
|
56
|
+
::Zerigo::DNS::Host.expects(:create).with(dest_params)
|
57
|
+
|
58
|
+
@dns.create_host_record(params)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_destroy_record
|
62
|
+
params = {:host => 'host1', :domain => 'example1.com'}
|
63
|
+
|
64
|
+
FakeWeb.register_uri(:get,
|
65
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts.xml?fqdn=host1.example1.com&zone_id=1",
|
66
|
+
:body => fakeweb_fixture('zerigo/host1.xml'))
|
67
|
+
FakeWeb.register_uri(:delete,
|
68
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts/1.xml",
|
69
|
+
:body => "")
|
70
|
+
|
71
|
+
@dns.destroy_host_record(params)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_update_record
|
75
|
+
params = {:host => 'host1', :domain => 'example1.com', :data => "1.1.1.1"}
|
76
|
+
|
77
|
+
FakeWeb.register_uri(:get,
|
78
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts.xml?fqdn=host1.example1.com&zone_id=1",
|
79
|
+
:body => fakeweb_fixture('zerigo/host1.xml'))
|
80
|
+
FakeWeb.register_uri(:post,
|
81
|
+
"http://foo%40bar.com:testtoken@ns.zerigo.com/api/1.1/hosts/1.xml",
|
82
|
+
:body => "")
|
83
|
+
|
84
|
+
@dns.update_host_record(params)
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
version: 1.3.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matt Conway
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-04-05 00:00:00 -04:00
|
18
18
|
default_executable: vulcanize
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -70,7 +70,7 @@ dependencies:
|
|
70
70
|
type: :runtime
|
71
71
|
version_requirements: *id004
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
73
|
+
name: zerigo_dns
|
74
74
|
prerelease: false
|
75
75
|
requirement: &id005 !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
type: :runtime
|
83
83
|
version_requirements: *id005
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name:
|
85
|
+
name: httparty
|
86
86
|
prerelease: false
|
87
87
|
requirement: &id006 !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
@@ -93,6 +93,18 @@ dependencies:
|
|
93
93
|
version: "0"
|
94
94
|
type: :runtime
|
95
95
|
version_requirements: *id006
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rails
|
98
|
+
prerelease: false
|
99
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
type: :runtime
|
107
|
+
version_requirements: *id007
|
96
108
|
description: The rubber plugin enables relatively complex multi-instance deployments of RubyOnRails applications to Amazon's Elastic Compute Cloud (EC2). Like capistrano, rubber is role based, so you can define a set of configuration files for a role and then assign that role to as many concrete instances as needed. One can also assign multiple roles to a single instance. This lets one start out with a single ec2 instance (belonging to all roles), and add new instances into the mix as needed to scale specific facets of your deployment, e.g. adding in instances that serve only as an 'app' role to handle increased app server load.
|
97
109
|
email: matt@conwaysplace.com
|
98
110
|
executables:
|
@@ -197,6 +209,7 @@ files:
|
|
197
209
|
- generators/vulcanize/templates/munin/templates.yml
|
198
210
|
- generators/vulcanize/templates/mysql/config/rubber/common/database.yml
|
199
211
|
- generators/vulcanize/templates/mysql/config/rubber/deploy-mysql.rb
|
212
|
+
- generators/vulcanize/templates/mysql/config/rubber/role/db/apparmor-mysql.conf
|
200
213
|
- generators/vulcanize/templates/mysql/config/rubber/role/db/crontab
|
201
214
|
- generators/vulcanize/templates/mysql/config/rubber/role/db/monit-mysql.cnf
|
202
215
|
- generators/vulcanize/templates/mysql/config/rubber/role/db/my.cnf
|
@@ -319,3 +332,4 @@ test_files:
|
|
319
332
|
- test/instance_test.rb
|
320
333
|
- test/test_helper.rb
|
321
334
|
- test/util_test.rb
|
335
|
+
- test/zerigo_test.rb
|