rhc 0.95.13 → 0.95.14
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/rhc-chk +41 -21
- metadata +4 -4
data/bin/rhc-chk
CHANGED
@@ -170,13 +170,15 @@ module TestBase
|
|
170
170
|
response = http.start {|http| http.request(req)}
|
171
171
|
return response
|
172
172
|
ensure
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
'
|
178
|
-
|
179
|
-
|
173
|
+
unless response.nil?
|
174
|
+
$debuginfo['fetches'] ||= []
|
175
|
+
body = RHC::json_decode(response.body)
|
176
|
+
body['data'] = body['data'] && body['data'] != '' ? RHC::json_decode(body['data']) : ''
|
177
|
+
$debuginfo['fetches'] << {url.to_s => {
|
178
|
+
'body' => body,
|
179
|
+
'header' => response.instance_variable_get(:@header)
|
180
|
+
}}
|
181
|
+
end
|
180
182
|
end
|
181
183
|
|
182
184
|
def continue_test
|
@@ -197,16 +199,25 @@ end
|
|
197
199
|
#####################################################
|
198
200
|
|
199
201
|
def error_for(name,*args)
|
200
|
-
|
201
|
-
|
202
|
-
|
202
|
+
# Make sure the name is a downcased symbol
|
203
|
+
name = name.to_s.downcase.to_sym
|
204
|
+
|
205
|
+
# Create message template
|
206
|
+
message = [:errors,:solutions].map{|x| get_message(x,name) }.compact.join("\n")
|
203
207
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
+
# Params for message template
|
209
|
+
params = args.flatten
|
210
|
+
|
211
|
+
# Ensure we have the right number of placeholders
|
212
|
+
num_placeholders = message.scan("%s").length
|
213
|
+
unless num_placeholders == params.length
|
214
|
+
warn("\nWARNING: error_for called with wrong number of args from: \n\t%s\n" % caller[0]) if $debug
|
215
|
+
# This will ensure we have the right number of arguments, but should not get here
|
216
|
+
params << Array.new(num_placeholders,"???")
|
208
217
|
end
|
209
|
-
|
218
|
+
|
219
|
+
# Return the message
|
220
|
+
message % params.flatten
|
210
221
|
end
|
211
222
|
|
212
223
|
def get_message(type,name)
|
@@ -320,16 +331,23 @@ class Test3_SSH < Test::Unit::TestCase
|
|
320
331
|
flunk(error_for(:no_account,test)) if $user_info.nil?
|
321
332
|
end
|
322
333
|
|
334
|
+
def require_domain(test)
|
335
|
+
flunk(error_for(:no_domain,test)) if $user_info['user_info']['domains'].empty?
|
336
|
+
end
|
337
|
+
|
323
338
|
def require_remote_keys(test)
|
324
339
|
require_login(test)
|
340
|
+
require_domain(test)
|
325
341
|
@@remote_pub_keys ||= (
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
my_keys.delete_if{|x| x.length == 0 }
|
342
|
+
ssh_keys = RHC::get_ssh_keys($libra_server, $rhlogin, $password, $http)
|
343
|
+
my_keys = [ssh_keys['ssh_key'], ssh_keys['keys'].values.map{|k| k['key']}].flatten
|
344
|
+
my_keys.delete_if{|x| x.length == 0 }
|
330
345
|
my_keys
|
331
346
|
)
|
332
|
-
|
347
|
+
|
348
|
+
missing_keys = [:nil?,:empty?].map{|f| @@remote_pub_keys.send(f) rescue false }.inject(:|)
|
349
|
+
|
350
|
+
flunk(error_for(:no_remote_pub_keys,test)) if missing_keys
|
333
351
|
end
|
334
352
|
|
335
353
|
def require_agent_keys(fatal = true)
|
@@ -376,7 +394,7 @@ class Test3_SSH < Test::Unit::TestCase
|
|
376
394
|
end
|
377
395
|
|
378
396
|
def test_03_remote_ssh_keys
|
379
|
-
require_remote_keys("whether
|
397
|
+
require_remote_keys("whether your local SSH keys match the ones in your account")
|
380
398
|
require_agent_keys(false)
|
381
399
|
|
382
400
|
assert !(@@remote_pub_keys & [agent_key_fingerprints,libra_public_key].flatten).empty? ,error_for(:pubkey_not_loaded," ")
|
@@ -384,6 +402,7 @@ class Test3_SSH < Test::Unit::TestCase
|
|
384
402
|
|
385
403
|
def test_04_ssh_connect
|
386
404
|
require_login("connecting to your applications")
|
405
|
+
require_domain("connecting to your applications")
|
387
406
|
|
388
407
|
host_template = "%%s-%s.%s" % [
|
389
408
|
$user_info['user_info']['domains'][0]['namespace'],
|
@@ -530,6 +549,7 @@ $messages = YAML.load <<-EOF
|
|
530
549
|
:no_derive: "We were unable to derive your public SSH key and compare it to the remote"
|
531
550
|
:no_connectivity: "Cannot connect to server, therefore most tests will not work"
|
532
551
|
:no_account: "You must have an account on the server in order to test: %s"
|
552
|
+
:no_domain: "You must have a domain associated with this account in order to test: %s"
|
533
553
|
:cant_connect: You need to be able to connect to the server in order to test authentication
|
534
554
|
:no_match_pub: "Local %s does not match remote pub key, SSH auth will not work"
|
535
555
|
:_404: "The user %s does not have an account on this server"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 383
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 95
|
9
|
-
-
|
10
|
-
version: 0.95.
|
9
|
+
- 14
|
10
|
+
version: 0.95.14
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Hat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-13 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|