@@ -46,8 +46,8 @@ def initialize(info = {})
46
46
)
47
47
register_options (
48
48
[
49
- OptString . new ( 'USERNAME' , [ true , 'User to login with' , '' ] ) ,
50
- OptString . new ( 'PASSWORD' , [ true , 'Password to login with' , '' ] ) ,
49
+ OptString . new ( 'USERNAME' , [ true , 'User to login with' ] ) ,
50
+ OptString . new ( 'PASSWORD' , [ true , 'Password to login with' ] ) ,
51
51
OptString . new ( 'TARGETURI' , [ true , 'The URI of Rancher instance' , '/' ] )
52
52
]
53
53
)
@@ -66,14 +66,11 @@ def rancher?
66
66
'uri' => normalize_uri ( target_uri . path , 'dashboard/' ) ,
67
67
'keep_cookies' => true
68
68
} )
69
- return false if res . nil?
70
- return false unless res . code == 200
69
+ return false unless res &.code == 200
71
70
72
71
html = res . get_html_document
73
72
title = html . at ( 'title' ) . text
74
- return true if title == 'dashboard' # this is a VERY weak check
75
-
76
- false
73
+ title == 'dashboard' # this is a VERY weak check
77
74
end
78
75
79
76
def login
@@ -83,7 +80,7 @@ def login
83
80
'keep_cookies' => true
84
81
} )
85
82
fail_with ( Failure ::Unreachable , "#{ peer } - Could not connect to web service - no response" ) if res . nil?
86
- fail_with ( Failure ::Unreachable , "#{ peer } - Could not connect to web service - no response" ) unless res . code == 200
83
+ fail_with ( Failure ::UnexpectedReply , "#{ peer } - Could not connect to web service - no response" ) unless res . code == 200
87
84
88
85
json_post_data = JSON . pretty_generate (
89
86
{
0 commit comments