cluster 0.5.40 → 0.5.50
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/bin/periodic.sh +0 -1
- data/lib/cluster.rb +38 -29
- data/lib/cluster/infrastructures/amazon_instance.rb +1 -1
- data/lib/cluster/version.rb +1 -1
- metadata +11 -11
data/bin/periodic.sh
CHANGED
data/lib/cluster.rb
CHANGED
|
@@ -114,8 +114,9 @@ class Cluster
|
|
|
114
114
|
@sub.new_instance(size, services)
|
|
115
115
|
end
|
|
116
116
|
rescue => err
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
msg ="#{Cluster::NAME} cannot start new instance: #{err.message}\n\t#{err.backtrace.join("\n\t")}"
|
|
118
|
+
$stderr.puts msg
|
|
119
|
+
raise RuntimeError.new(msg)
|
|
119
120
|
end
|
|
120
121
|
end
|
|
121
122
|
|
|
@@ -126,33 +127,37 @@ class Cluster
|
|
|
126
127
|
|
|
127
128
|
def current(*params)
|
|
128
129
|
unless @sub.in_cluster?
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
msg = "#{Cluster::NAME} says that we aren't in the cluster?"
|
|
131
|
+
$stderr.puts msg
|
|
132
|
+
raise RuntimeError.new(msg)
|
|
131
133
|
end
|
|
132
134
|
|
|
133
135
|
unless params.length > 0
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
msg = "#{Cluster::NAME} current needs to know what to do?\n\t* services\n\t* name (|| dns)\n\t* ip\n\t* enable\n\t* disable"
|
|
137
|
+
$stderr.puts msg
|
|
138
|
+
raise ArgumentError.new(msg)
|
|
136
139
|
end
|
|
137
140
|
|
|
141
|
+
current = @sub.current_instance
|
|
138
142
|
cmd = params.shift
|
|
139
143
|
|
|
140
144
|
case cmd.downcase
|
|
141
145
|
when 'services'
|
|
142
|
-
|
|
146
|
+
current.services - current.disabled_services
|
|
143
147
|
when /^(n|dn)/
|
|
144
|
-
|
|
148
|
+
current.dns
|
|
145
149
|
when /^i/
|
|
146
|
-
|
|
150
|
+
current.ip
|
|
147
151
|
when /^e/
|
|
148
|
-
@sub.alter_instances!(
|
|
152
|
+
@sub.alter_instances!(current) {|i| i.enable *params }
|
|
149
153
|
when /^di/
|
|
150
|
-
@sub.alter_instances!(
|
|
154
|
+
@sub.alter_instances!(current) {|i| i.disable *params }
|
|
151
155
|
when /^s/
|
|
152
|
-
@sub.alter_instances!(
|
|
156
|
+
@sub.alter_instances!(current) {|i| i.set_state *params }
|
|
153
157
|
else
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
msg = "#{Cluster::NAME} curent did not understand '#{params.join(' ')}'"
|
|
159
|
+
$stderr.puts msg
|
|
160
|
+
raise ArgumentError.new(msg)
|
|
156
161
|
end
|
|
157
162
|
end
|
|
158
163
|
alias :instance :current
|
|
@@ -170,8 +175,9 @@ class Cluster
|
|
|
170
175
|
elsif File.readable? File.basename(full_key)
|
|
171
176
|
File.open(File.basename(full_key))
|
|
172
177
|
else
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
msg = "#{Cluster::NAME} cannot open a file for storage with key: #{full_key}"
|
|
179
|
+
$stderr.puts msg
|
|
180
|
+
raise RuntimeError.new(msg)
|
|
175
181
|
end
|
|
176
182
|
@sub.store full_key, file
|
|
177
183
|
end
|
|
@@ -180,12 +186,11 @@ class Cluster
|
|
|
180
186
|
res = @sub.retrieve File.join(service, key)
|
|
181
187
|
if output
|
|
182
188
|
begin
|
|
183
|
-
File.open(output, 'w') {|f|
|
|
184
|
-
f.write res
|
|
185
|
-
}
|
|
189
|
+
File.open(output, 'w') {|f| f.write res }
|
|
186
190
|
rescue => err
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
msg = "#{Cluster::NAME} cannot open #{output} for writing."
|
|
192
|
+
$stderr.puts msg
|
|
193
|
+
raise RuntimeError.new(msg)
|
|
189
194
|
end
|
|
190
195
|
else
|
|
191
196
|
res
|
|
@@ -205,16 +210,18 @@ class Cluster
|
|
|
205
210
|
def save_monitor(filename, key = nil)
|
|
206
211
|
file = open(filename)
|
|
207
212
|
unless file
|
|
208
|
-
|
|
209
|
-
|
|
213
|
+
msg = "#{Cluster::NAME} cannot open file '#{filename}' for reading."
|
|
214
|
+
$stderr.puts msg
|
|
215
|
+
raise RuntimeError.new(msg)
|
|
210
216
|
end
|
|
211
217
|
|
|
212
218
|
key ||= File.basename(filename)
|
|
213
219
|
begin
|
|
214
220
|
@sub.save_monitor file, key
|
|
215
221
|
rescue => err
|
|
216
|
-
|
|
217
|
-
|
|
222
|
+
msg = "#{Cluster::NAME} could not save monitor configuration: #{err.message}\n\t#{err.backtrace.join("\n\t")}"
|
|
223
|
+
$stderr.puts msg
|
|
224
|
+
raise RuntimeError.new(msg)
|
|
218
225
|
end
|
|
219
226
|
end
|
|
220
227
|
|
|
@@ -224,8 +231,9 @@ class Cluster
|
|
|
224
231
|
|
|
225
232
|
def fetch_credentials(url)
|
|
226
233
|
unless Cluster::Configuration.credentials?
|
|
227
|
-
|
|
228
|
-
|
|
234
|
+
msg = "Need to know where to save the incoming credentials."
|
|
235
|
+
$stderr.puts msg
|
|
236
|
+
raise RuntimeError.new(msg)
|
|
229
237
|
end
|
|
230
238
|
|
|
231
239
|
out = File.open(Cluster::Configuration[:credentials_file], 'w')
|
|
@@ -236,8 +244,9 @@ class Cluster
|
|
|
236
244
|
def fetch_monitor(output)
|
|
237
245
|
monitor = @sub.fetch_monitor
|
|
238
246
|
unless monitor
|
|
239
|
-
|
|
240
|
-
|
|
247
|
+
msg = "#{Cluster::NAME} cannot find any monitor information."
|
|
248
|
+
$stderr.puts msg
|
|
249
|
+
raise RuntimeError.new(msg)
|
|
241
250
|
end
|
|
242
251
|
|
|
243
252
|
File.open(output, 'w') {|f|
|
|
@@ -193,7 +193,7 @@ class AmazonInstance < Instance
|
|
|
193
193
|
chmod 600 $MONITOR
|
|
194
194
|
chown $CLUSTER_USER $MONITOR
|
|
195
195
|
mv $MONITOR /etc/god/init.d/cluster.god
|
|
196
|
-
$GOD load /etc/god/init.d/
|
|
196
|
+
$GOD load /etc/god/init.d/010_cluster.god
|
|
197
197
|
else
|
|
198
198
|
echo "NO MONITOR FILE!"
|
|
199
199
|
exit 1
|
data/lib/cluster/version.rb
CHANGED
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 5
|
|
8
|
-
-
|
|
9
|
-
version: 0.5.
|
|
8
|
+
- 50
|
|
9
|
+
version: 0.5.50
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Simon de Boer
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2011-
|
|
17
|
+
date: 2011-11-03 00:00:00 +00:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -148,22 +148,22 @@ extensions: []
|
|
|
148
148
|
extra_rdoc_files: []
|
|
149
149
|
|
|
150
150
|
files:
|
|
151
|
-
- lib/cluster/
|
|
152
|
-
- lib/cluster/configuration.rb
|
|
151
|
+
- lib/cluster/release.rb
|
|
153
152
|
- lib/cluster/infrastructure.rb
|
|
154
|
-
- lib/cluster/infrastructures/amazon.rb
|
|
155
|
-
- lib/cluster/infrastructures/amazon_instance.rb
|
|
156
|
-
- lib/cluster/infrastructures/amazon_release.rb
|
|
157
153
|
- lib/cluster/instance.rb
|
|
158
|
-
- lib/cluster/release.rb
|
|
159
154
|
- lib/cluster/version.rb
|
|
155
|
+
- lib/cluster/configuration.rb
|
|
156
|
+
- lib/cluster/infrastructures/amazon_instance.rb
|
|
157
|
+
- lib/cluster/infrastructures/amazon_release.rb
|
|
158
|
+
- lib/cluster/infrastructures/amazon.rb
|
|
159
|
+
- lib/cluster/cli.rb
|
|
160
160
|
- lib/cluster.rb
|
|
161
161
|
- lib/ext/array.rb
|
|
162
162
|
- lib/ext/cluster_extensions.rb
|
|
163
|
-
- bin/cluster
|
|
164
163
|
- bin/periodic.sh
|
|
165
|
-
-
|
|
164
|
+
- bin/cluster
|
|
166
165
|
- VERSION
|
|
166
|
+
- Rakefile
|
|
167
167
|
has_rdoc: true
|
|
168
168
|
homepage: http://oven.s3.amazonaws.com/cluster.gem
|
|
169
169
|
licenses: []
|