smartos-manager 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +11 -11
- data/lib/smartos-manager/cli.rb +11 -0
- data/lib/smartos-manager/core.rb +20 -10
- data/lib/smartos-manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 623bb38ba01a9e00f9bd141beca2340cc705700c
|
4
|
+
data.tar.gz: c4f2d566102caeb8de069eef4e57a1d4265c631c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e8dbba3850f91ef503260bf7c5f691e322880a200deb16940bdf79ac6df332d68fccd27a91f09d87e7fa1913ea8b1ad194299518d91915e4429a0014d47d86
|
7
|
+
data.tar.gz: b6d64d6fa46c2baad1366b3635920719e06d77c089aff5df6b183f086a9632bcf2718458c50743b17a6fc841b14c6a4cfdace1b65e4c9993a4bb39d6c99d88fd
|
data/Gemfile
CHANGED
@@ -4,14 +4,14 @@ gemspec
|
|
4
4
|
|
5
5
|
gem 'rake'
|
6
6
|
|
7
|
-
group(:test) do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
7
|
+
# group(:test) do
|
8
|
+
# gem 'eetee', '~> 0.0.4'
|
9
|
+
# gem 'mocha', '~> 0.12.0'
|
10
|
+
# # gem 'factory_girl'
|
11
|
+
# gem 'rb-blink1'
|
12
|
+
#
|
13
|
+
# gem 'simplecov'
|
14
|
+
# gem 'guard'
|
15
|
+
# gem 'rb-fsevent'
|
16
|
+
# gem 'growl'
|
17
|
+
# end
|
data/lib/smartos-manager/cli.rb
CHANGED
@@ -63,6 +63,17 @@ class AppCLI < Thor
|
|
63
63
|
sysinfos = registry.sysinfo()
|
64
64
|
diags = registry.diag()
|
65
65
|
|
66
|
+
failures = registry.failed_connections()
|
67
|
+
unless failures.empty?
|
68
|
+
puts "Error while connecting to:".red()
|
69
|
+
failures.each do |s|
|
70
|
+
puts " - #{s.name} : #{s.address}".red()
|
71
|
+
end
|
72
|
+
|
73
|
+
puts ""
|
74
|
+
end
|
75
|
+
|
76
|
+
|
66
77
|
user_columns = registry.user_columns.keys.map{|s| humanize(s) }
|
67
78
|
|
68
79
|
p_vm_list("Memory", "Name (gray = online)", "Type", "UUID", "State", "Admin IP", "DD(GB)", *user_columns)
|
data/lib/smartos-manager/core.rb
CHANGED
@@ -174,13 +174,16 @@ class Registry
|
|
174
174
|
|
175
175
|
run_on_all("prtdiag").each do |addr, data|
|
176
176
|
host = find_host(addr)
|
177
|
+
system_id = "(none)"
|
177
178
|
free_memory_banks = 0
|
178
179
|
|
179
|
-
|
180
|
-
|
181
|
-
|
180
|
+
if matches = data.match(/^System Configuration: (.+)$/)
|
181
|
+
system_id = mastches[1]
|
182
|
+
data.scan(/(empty).*DIMM\s+([0-9])/).each do |reg|
|
183
|
+
free_memory_banks+= 1
|
184
|
+
end
|
182
185
|
end
|
183
|
-
|
186
|
+
|
184
187
|
ret[host] = {
|
185
188
|
system_id: system_id,
|
186
189
|
free_memory_banks: free_memory_banks
|
@@ -301,28 +304,31 @@ class SSHRegistry < Registry
|
|
301
304
|
puts "(( Using live data ))"
|
302
305
|
super
|
303
306
|
|
307
|
+
@failed_connections = []
|
308
|
+
|
304
309
|
@gateways = {}
|
305
|
-
@connection = Net::SSH::Multi.start()
|
310
|
+
@connection = Net::SSH::Multi.start(:on_error => ->(server){
|
311
|
+
@failed_connections << server.host
|
312
|
+
})
|
306
313
|
|
307
314
|
@hosts.each do |_, host|
|
308
315
|
@connection.use(host.address,
|
309
316
|
via: gateway_for(host.gateway, host.gateway_user),
|
310
|
-
# via: @gateways[host.gateway],
|
311
317
|
user: host.user,
|
312
318
|
timeout: 20,
|
319
|
+
auth_methods: %w(publickey),
|
313
320
|
compression: false
|
314
321
|
)
|
315
322
|
end
|
316
|
-
|
317
323
|
end
|
318
324
|
|
319
325
|
def run_on_all(cmd)
|
320
326
|
ret = {}
|
321
327
|
|
322
328
|
# set the keys in cas we get nothing back
|
323
|
-
@hosts.each do |addr, _|
|
324
|
-
|
325
|
-
end
|
329
|
+
# @hosts.each do |addr, _|
|
330
|
+
# ret[addr] = ""
|
331
|
+
# end
|
326
332
|
|
327
333
|
channel = @connection.exec(cmd) do |ch, stream, data|
|
328
334
|
host = @hosts[ch[:host]]
|
@@ -335,6 +341,10 @@ class SSHRegistry < Registry
|
|
335
341
|
|
336
342
|
ret
|
337
343
|
end
|
344
|
+
|
345
|
+
def failed_connections
|
346
|
+
@failed_connections.map{|address| @hosts[address] }
|
347
|
+
end
|
338
348
|
|
339
349
|
private
|
340
350
|
def gateway_for(host, user)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartos-manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Ammous
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|