rudy 0.9.5.003 → 0.9.5.004
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +1 -0
- data/lib/rudy.rb +5 -5
- data/lib/rudy/cli/routines.rb +9 -0
- data/lib/rudy/metadata/machine.rb +0 -15
- data/lib/rudy/routines/handlers/host.rb +43 -6
- data/lib/rudy/routines/startup.rb +1 -0
- data/rudy.gemspec +1 -1
- metadata +2 -2
data/CHANGES.txt
CHANGED
data/lib/rudy.rb
CHANGED
@@ -13,19 +13,19 @@ begin; require 'json'; rescue LoadError; end # Silence!
|
|
13
13
|
require 'digest/md5'
|
14
14
|
require 'stringio'
|
15
15
|
require 'ostruct'
|
16
|
-
|
16
|
+
require 'yaml'
|
17
17
|
require 'logger'
|
18
18
|
require 'socket'
|
19
19
|
require 'resolv'
|
20
20
|
require 'timeout'
|
21
|
-
|
21
|
+
require 'gibbler/aliases'
|
22
22
|
require 'tempfile'
|
23
23
|
require 'rudy/mixins'
|
24
24
|
require 'storable'
|
25
|
-
|
25
|
+
require 'sysinfo'
|
26
26
|
require 'attic'
|
27
27
|
require 'annoy'
|
28
|
-
|
28
|
+
require 'rye'
|
29
29
|
|
30
30
|
# = Rudy
|
31
31
|
#
|
@@ -42,7 +42,7 @@ module Rudy
|
|
42
42
|
MAJOR = 0.freeze
|
43
43
|
MINOR = 9.freeze
|
44
44
|
TINY = 5.freeze
|
45
|
-
PATCH = '
|
45
|
+
PATCH = '004'.freeze
|
46
46
|
end
|
47
47
|
def self.to_s; [MAJOR, MINOR, TINY, PATCH].join('.'); end
|
48
48
|
def self.to_f; self.to_s.to_f; end
|
data/lib/rudy/cli/routines.rb
CHANGED
@@ -20,6 +20,15 @@ module Rudy; module CLI;
|
|
20
20
|
routine = {}
|
21
21
|
routine.merge! @@config.routines.find_deferred(@@global.environment, @@global.role) || {}
|
22
22
|
routine.merge! @@config.routines.find(@@global.role) || {}
|
23
|
+
#envs, roles = @@global.environment || [], @@global.role || []
|
24
|
+
#envs.each do |env|
|
25
|
+
# roles.each do |role|
|
26
|
+
# routine.merge! @@config.routines.find_deferred(env, role) || {}
|
27
|
+
# end
|
28
|
+
#end
|
29
|
+
#roles.each do |role|
|
30
|
+
# routine.merge! @@config.routines.find(role) || {}
|
31
|
+
#end
|
23
32
|
end
|
24
33
|
|
25
34
|
outform = @@global.format == :json ? :to_json : :to_yaml
|
@@ -158,21 +158,6 @@ module Rudy
|
|
158
158
|
@state = inst.state
|
159
159
|
# We need to be safe when creating machines because if an exception is
|
160
160
|
# raised, instances will have been created but the calling class won't know.
|
161
|
-
begin
|
162
|
-
# Assign IP address only if we have one for that position
|
163
|
-
if @address
|
164
|
-
# Make sure the address is associated to the current account
|
165
|
-
if Rudy::AWS::EC2::Addresses.exists?(@address)
|
166
|
-
li "Associating #{@address} to #{@instid}"
|
167
|
-
Rudy::AWS::EC2::Addresses.associate(@address, @instid)
|
168
|
-
else
|
169
|
-
le "Unknown address: #{@address}"
|
170
|
-
end
|
171
|
-
end
|
172
|
-
rescue => ex
|
173
|
-
le "Error: #{ex.message}"
|
174
|
-
le ex.backtrace if Rudy.debug?
|
175
|
-
end
|
176
161
|
end
|
177
162
|
|
178
163
|
self.save
|
@@ -24,26 +24,63 @@ module Rudy; module Routines; module Handlers;
|
|
24
24
|
# it's also important to call here because if a routine was executed
|
25
25
|
# and an unexpected exception occurs before this update is executed
|
26
26
|
# the machine metadata won't contain the DNS information. Calling it
|
27
|
-
# here
|
27
|
+
# here ensures that the metadata is always up-to-date.
|
28
|
+
#
|
29
|
+
# If a machine has an associated elastic IP address, it will also be
|
30
|
+
# assigned in this step.
|
31
|
+
#
|
28
32
|
# Each Rye:Box instance has a Rudy::Machine instance in its stash so
|
29
33
|
# rbox.stash.refresh! == machine.refresh!
|
30
34
|
def update_dns(rset)
|
31
35
|
raise NoMachines if rset.boxes.empty?
|
32
36
|
rset.boxes.each do |rbox|
|
33
|
-
rbox.stash
|
34
|
-
|
37
|
+
mach = rbox.stash
|
38
|
+
# Assign IP address only if we have one for that position
|
39
|
+
if mach.address
|
40
|
+
begin
|
41
|
+
# Make sure the address is associated to the current account
|
42
|
+
if Rudy::AWS::EC2::Addresses.exists?(mach.address)
|
43
|
+
li "Associating #{mach.address} to #{mach.instid}"
|
44
|
+
Rudy::AWS::EC2::Addresses.associate(mach.address, mach.instid)
|
45
|
+
else
|
46
|
+
le "Unknown address: #{mach.address}"
|
47
|
+
end
|
48
|
+
rescue => ex
|
49
|
+
le "Error associating address: #{ex.message}"
|
50
|
+
ld ex.backtrace
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Give EC2 some time to update their metadata
|
55
|
+
msg = "Waiting for public DNS on #{rbox.nickname} ..."
|
56
|
+
multi = rbox.stash.windows? ? 3 : 2
|
57
|
+
interval, max = 2*multi, 60*multi
|
58
|
+
Rudy::Utils.waiter(interval, max, STDOUT, msg, 0) {
|
59
|
+
mach.refresh!
|
60
|
+
if mach.address
|
61
|
+
mach.dns_public.to_s =~ /#{mach.address.to_s.gsub('.', '-')}/
|
62
|
+
else
|
63
|
+
!mach.dns_public.nil? && !mach.dns_public.empty?
|
64
|
+
end
|
65
|
+
}
|
66
|
+
rbox.host = mach.dns_public
|
35
67
|
end
|
36
68
|
end
|
37
69
|
|
38
70
|
def is_available?(rset, port=22)
|
39
71
|
raise NoMachines if rset.boxes.empty?
|
40
72
|
rset.boxes.each do |rbox|
|
73
|
+
mach = rbox.stash
|
74
|
+
# This updates the DNS. It's important this happens
|
75
|
+
# before and after the address is updated otherwise
|
76
|
+
# certain errors will causes it to not be updated.
|
77
|
+
mach.refresh!
|
41
78
|
msg = "Waiting for port #{port} on #{rbox.nickname} ..."
|
42
|
-
port = 3389 if
|
43
|
-
multi =
|
79
|
+
port = 3389 if mach.windows?
|
80
|
+
multi = mach.windows? ? 3 : 2
|
44
81
|
interval, max = 1*multi, 30*multi
|
45
82
|
Rudy::Utils.waiter(interval, max, STDOUT, msg, 0) {
|
46
|
-
Rudy::Utils.service_available?(
|
83
|
+
Rudy::Utils.service_available?(mach.dns_public, port)
|
47
84
|
}
|
48
85
|
end
|
49
86
|
end
|
@@ -72,6 +72,7 @@ module Rudy; module Routines;
|
|
72
72
|
|
73
73
|
# This is important b/c the machines will not
|
74
74
|
# have DNS info until after they are running.
|
75
|
+
# This will also assigns elastic IP addresses.
|
75
76
|
Rudy::Routines.rescue { Rudy::Routines::Handlers::Host.update_dns @@rset }
|
76
77
|
|
77
78
|
Rudy::Routines.rescue {
|
data/rudy.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rudy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.5.
|
4
|
+
version: 0.9.5.004
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|