rest_connection 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -118,19 +118,29 @@ class Server
118
118
  end
119
119
 
120
120
  # waits until the server is operational and dns_name is available
121
- def wait_for_operational_with_dns(state_wait_timeout=1200)
122
- timeout = 600
123
- wait_for_state("operational", state_wait_timeout)
124
- step = 15
125
- while(timeout > 0)
121
+ def wait_for_operational_with_dns(operational_timeout_in_seconds = 1200, dns_timeout_in_seconds = operational_timeout_in_seconds / 2)
122
+ # First, wait for the server to go operational
123
+ wait_for_state("operational", operational_timeout_in_seconds)
124
+
125
+ # Log that we are switching to waiting for dns
126
+ connection.logger "#{self.nickname} is operational, now checking for dns name/ip address..."
127
+
128
+ # Now poll for valid dns
129
+ dns_timeout = dns_timeout_in_seconds
130
+ dns_step = 15
131
+ while(dns_timeout > 0)
126
132
  self.settings
127
- break if self.reachable_ip
128
- connection.logger "waiting for IP for #{self.nickname}"
129
- sleep step
130
- timeout -= step
133
+ if self.reachable_ip
134
+ # Got a dns name/ip address so log that and return (note that "reachable_ip" returns a dns name on AWS and an ip address on generic clouds)
135
+ connection.logger "Got dns name/ip address: #{self.reachable_ip}."
136
+ return
137
+ end
138
+ connection.logger "Waiting #{dns_step} seconds before checking for dns name/ip address on #{self.nickname}..."
139
+ sleep dns_step
140
+ dns_timeout -= dns_step
131
141
  end
132
- connection.logger "got IP: #{self.reachable_ip}"
133
- raise "FATAL, this server #{self.audit_link} timed out waiting for IP" if timeout <= 0
142
+
143
+ raise "FATAL, server #{self.nickname}, #{self.audit_link} timed out waiting for dns name/ip address, waited for #{dns_timeout_in_seconds}."
134
144
  end
135
145
 
136
146
  def audit_link
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_connection
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeremy Deininger
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-11-13 00:00:00 Z
19
+ date: 2012-11-20 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activesupport