awsome 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/awsome/executor.rb +22 -11
- metadata +1 -1
data/lib/awsome/executor.rb
CHANGED
@@ -21,6 +21,18 @@ module Awsome
|
|
21
21
|
terminate
|
22
22
|
end
|
23
23
|
|
24
|
+
def instances_to_use(&block)
|
25
|
+
@i_pool.each_with_index do |instance, index|
|
26
|
+
yield(instance, @r_pool[index]) if index < @r_pool.length
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def instances_to_terminate(&block)
|
31
|
+
@i_pool.each_with_index do |instance, index|
|
32
|
+
yield(instance) if index >= @r_pool.length
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
24
36
|
def run
|
25
37
|
@i_pool.each_with_index do |instance, i|
|
26
38
|
@i_pool[i] = Awsome::Ec2.run_instance(@r_pool[i].properties) if instance.nil?
|
@@ -28,30 +40,29 @@ module Awsome
|
|
28
40
|
end
|
29
41
|
|
30
42
|
def wait_for_ssh
|
31
|
-
|
32
|
-
|
33
|
-
|
43
|
+
instances_to_use do |instance, requirement|
|
44
|
+
instance.wait_until_running!
|
45
|
+
instance.wait_for_ssh!
|
34
46
|
end
|
35
47
|
end
|
36
48
|
|
37
49
|
def reattach_volumes
|
38
|
-
|
39
|
-
instance.reattach_volumes(
|
50
|
+
instances_to_use do |instance, requirement|
|
51
|
+
instance.reattach_volumes(*requirement.volumes_to_attach(instance))
|
40
52
|
end
|
41
53
|
end
|
42
54
|
|
43
55
|
def deploy
|
44
|
-
|
56
|
+
instances_to_use do |instance, requirement|
|
45
57
|
instance.deregister_from_elbs
|
46
|
-
instance.remove_packages(
|
47
|
-
instance.install_packages(
|
48
|
-
instance.register_with_elbs(
|
58
|
+
instance.remove_packages(*requirement.packages_to_remove(instance))
|
59
|
+
instance.install_packages(*requirement.packages_to_install(instance))
|
60
|
+
instance.register_with_elbs(*requirement.elbs)
|
49
61
|
end
|
50
62
|
end
|
51
63
|
|
52
64
|
def terminate
|
53
|
-
|
54
|
-
next if i < @r_pool.length
|
65
|
+
instances_to_terminate do |instance|
|
55
66
|
instance.deregister_from_elbs
|
56
67
|
instance.terminate
|
57
68
|
end
|