rhc 0.77.8 → 0.79.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rhc-chk +12 -5
- data/bin/rhc-create-app +9 -4
- data/bin/rhc-create-domain +11 -6
- data/bin/rhc-ctl-app +23 -5
- data/bin/rhc-snapshot +6 -1
- data/bin/rhc-tail-files +7 -2
- data/bin/rhc-user-info +7 -2
- data/conf/express.conf +4 -1
- data/lib/rhc-common.rb +41 -25
- metadata +5 -5
data/bin/rhc-chk
CHANGED
@@ -42,7 +42,8 @@ properly setup. Often run to troubleshoot connection issues.
|
|
42
42
|
-p|--password password Red Hat password (for RHN or OpenShift)
|
43
43
|
-d|--debug Print Debug info
|
44
44
|
-h|--help Show Usage info
|
45
|
-
--config path
|
45
|
+
--config path Path of alternate config file
|
46
|
+
--timeout # Timeout, in seconds, for connection
|
46
47
|
|
47
48
|
USAGE
|
48
49
|
exit 255
|
@@ -54,7 +55,8 @@ begin
|
|
54
55
|
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
55
56
|
["--rhlogin", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
56
57
|
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
57
|
-
["--config", GetoptLong::REQUIRED_ARGUMENT]
|
58
|
+
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
59
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
58
60
|
)
|
59
61
|
opt = {}
|
60
62
|
opts.each do |o, a|
|
@@ -79,6 +81,9 @@ end
|
|
79
81
|
if opt["debug"]
|
80
82
|
@debug = true
|
81
83
|
end
|
84
|
+
RHC::debug(@debug)
|
85
|
+
|
86
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
82
87
|
|
83
88
|
opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
|
84
89
|
if !RHC::check_rhlogin(opt['rhlogin'])
|
@@ -205,8 +210,10 @@ else
|
|
205
210
|
puts " FIX: Perhaps you should regenerate your public key, or run rhc-create-domain with -a to alter the remote key"
|
206
211
|
end
|
207
212
|
|
208
|
-
|
209
|
-
puts "
|
210
|
-
puts "
|
213
|
+
if @debug
|
214
|
+
puts "remote_ssh_pubkey: #{remote_ssh_pubkey}"
|
215
|
+
puts "local_ssh_pubkey: #{local_ssh_pubkey}"
|
216
|
+
puts "local_derived_ssh_pubkey: #{local_derived_ssh_pubkey}"
|
217
|
+
end
|
211
218
|
|
212
219
|
exit 0
|
data/bin/rhc-create-app
CHANGED
@@ -41,6 +41,7 @@ Create an OpenShift Express app.
|
|
41
41
|
-d|--debug Print Debug info
|
42
42
|
-h|--help Show Usage info
|
43
43
|
--config path Path of alternate config file
|
44
|
+
--timeout # Timeout, in seconds, for connection
|
44
45
|
|
45
46
|
USAGE
|
46
47
|
exit 255
|
@@ -56,7 +57,8 @@ begin
|
|
56
57
|
["--app", "-a", GetoptLong::REQUIRED_ARGUMENT],
|
57
58
|
["--repo", "-r", GetoptLong::REQUIRED_ARGUMENT],
|
58
59
|
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
59
|
-
["--type", "-t", GetoptLong::REQUIRED_ARGUMENT]
|
60
|
+
["--type", "-t", GetoptLong::REQUIRED_ARGUMENT],
|
61
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
60
62
|
)
|
61
63
|
opt = {}
|
62
64
|
opts.each do |o, a|
|
@@ -84,6 +86,9 @@ end
|
|
84
86
|
if opt["debug"]
|
85
87
|
debug = true
|
86
88
|
end
|
89
|
+
RHC::debug(debug)
|
90
|
+
|
91
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
87
92
|
|
88
93
|
opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
|
89
94
|
|
@@ -168,11 +173,11 @@ response = RHC::http_post(@http, url, json_data, password)
|
|
168
173
|
|
169
174
|
if response.code == '200'
|
170
175
|
json_resp = JSON.parse(response.body)
|
171
|
-
RHC::print_response_success(json_resp,
|
176
|
+
RHC::print_response_success(json_resp, true)
|
172
177
|
json_data = JSON.parse(json_resp['data'])
|
173
178
|
health_check_path = json_data['health_check_path']
|
174
179
|
else
|
175
|
-
RHC::print_response_err(response
|
180
|
+
RHC::print_response_err(response)
|
176
181
|
end
|
177
182
|
|
178
183
|
#
|
@@ -199,7 +204,7 @@ end
|
|
199
204
|
|
200
205
|
puts "Checking ~/.ssh/config"
|
201
206
|
|
202
|
-
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http,
|
207
|
+
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http, false)
|
203
208
|
|
204
209
|
fqdn = "#{opt['app']}-#{user_info['user_info']['namespace']}.#{user_info['user_info']['rhc_domain']}"
|
205
210
|
|
data/bin/rhc-create-domain
CHANGED
@@ -43,6 +43,7 @@ Bind a registered rhcloud user to a domain in rhcloud.
|
|
43
43
|
-d|--debug Print Debug info
|
44
44
|
-h|--help Show Usage info
|
45
45
|
--config path Path of alternate config file
|
46
|
+
--timeout # Timeout, in seconds, for connection
|
46
47
|
|
47
48
|
USAGE
|
48
49
|
exit 255
|
@@ -56,7 +57,8 @@ begin
|
|
56
57
|
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
57
58
|
["--namespace", "-n", GetoptLong::REQUIRED_ARGUMENT],
|
58
59
|
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
59
|
-
["--alter", "-a", GetoptLong::NO_ARGUMENT]
|
60
|
+
["--alter", "-a", GetoptLong::NO_ARGUMENT],
|
61
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
60
62
|
)
|
61
63
|
|
62
64
|
opt = {}
|
@@ -86,6 +88,9 @@ end
|
|
86
88
|
if opt["debug"]
|
87
89
|
debug = true
|
88
90
|
end
|
91
|
+
RHC::debug(debug)
|
92
|
+
|
93
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
89
94
|
|
90
95
|
if !RHC::check_namespace(opt['namespace'])
|
91
96
|
p_usage
|
@@ -141,12 +146,12 @@ data = {'namespace' => opt['namespace'],
|
|
141
146
|
if (opt['alter'])
|
142
147
|
data['alter'] = "true"
|
143
148
|
not_found_message = "A user with rhlogin '#{opt['rhlogin']}' does not have a registered domain. Be sure to run rhc-create-domain without -a|--alter first."
|
144
|
-
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http,
|
149
|
+
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http, true, not_found_message)
|
145
150
|
end
|
146
151
|
if debug
|
147
152
|
data['debug'] = "true"
|
148
153
|
end
|
149
|
-
RHC::print_post_data(data
|
154
|
+
RHC::print_post_data(data)
|
150
155
|
json_data = RHC::generate_json(data)
|
151
156
|
|
152
157
|
url = URI.parse("https://#{libra_server}/broker/domain")
|
@@ -155,7 +160,7 @@ response = RHC::http_post(@http, url, json_data, password)
|
|
155
160
|
if response.code == '200'
|
156
161
|
begin
|
157
162
|
json_resp = JSON.parse(response.body)
|
158
|
-
RHC::print_response_success(json_resp
|
163
|
+
RHC::print_response_success(json_resp)
|
159
164
|
json_rhlogininfo = JSON.parse(json_resp['data'])
|
160
165
|
add_rhlogin_config(json_rhlogininfo['rhlogin'], json_rhlogininfo['uuid'])
|
161
166
|
|
@@ -204,9 +209,9 @@ EOF
|
|
204
209
|
end
|
205
210
|
exit 0
|
206
211
|
rescue JSON::ParserError
|
207
|
-
RHC::print_response_err(response
|
212
|
+
RHC::print_response_err(response)
|
208
213
|
end
|
209
214
|
else
|
210
|
-
RHC::print_response_err(response
|
215
|
+
RHC::print_response_err(response)
|
211
216
|
end
|
212
217
|
exit 254
|
data/bin/rhc-ctl-app
CHANGED
@@ -37,11 +37,12 @@ Control an OpenShift express app
|
|
37
37
|
-p|--password password RHLogin password (optional, will prompt)
|
38
38
|
-c|--command command (start|stop|restart|reload|status|destroy)
|
39
39
|
-L|--embedded-list List supported embedded cartridges
|
40
|
-
-e|--embed (add
|
40
|
+
-e|--embed (add|remove|stop|start|restart|status|reload)-$cartridge eg: add-mysql-5.1
|
41
41
|
-b|--bypass Bypass warnings
|
42
42
|
-d|--debug Print Debug info
|
43
43
|
-h|--help Show Usage info
|
44
44
|
--config path Path of alternate config file
|
45
|
+
--timeout # Timeout, in seconds, for connection
|
45
46
|
|
46
47
|
USAGE
|
47
48
|
exit 255
|
@@ -69,7 +70,8 @@ begin
|
|
69
70
|
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
70
71
|
["--app", "-a", GetoptLong::REQUIRED_ARGUMENT],
|
71
72
|
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
72
|
-
["--command", "-c", GetoptLong::REQUIRED_ARGUMENT]
|
73
|
+
["--command", "-c", GetoptLong::REQUIRED_ARGUMENT],
|
74
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
73
75
|
)
|
74
76
|
opt = {}
|
75
77
|
opts.each do |o, a|
|
@@ -99,6 +101,9 @@ end
|
|
99
101
|
if opt["debug"]
|
100
102
|
debug = true
|
101
103
|
end
|
104
|
+
RHC::debug(debug)
|
105
|
+
|
106
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
102
107
|
|
103
108
|
opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
|
104
109
|
|
@@ -110,11 +115,24 @@ if !RHC::check_app(opt['app'])
|
|
110
115
|
p_usage
|
111
116
|
end
|
112
117
|
|
113
|
-
unless opt["embed"] or
|
118
|
+
unless opt["embed"] or opt["command"]
|
114
119
|
puts "Command or embed is required"
|
115
120
|
p_usage
|
116
121
|
end
|
117
122
|
|
123
|
+
if opt["command"]
|
124
|
+
unless opt["command"] =~ /^(start|stop|restart|reload|status|destroy)$/
|
125
|
+
puts "Invalid command '#{opt["command"]}' specified. Valid commands are (start|stop|restart|reload|status|destroy)"
|
126
|
+
p_usage
|
127
|
+
end
|
128
|
+
elsif opt["embed"]
|
129
|
+
action = opt['embed'].split('-')[0]
|
130
|
+
unless action =~ /^(add|remove|start|stop|restart|status|reload)$/
|
131
|
+
puts "Invalid embed action '#{action}' specified. Valid embed actions are (add|remove|start|stop|restart|status|reload)"
|
132
|
+
p_usage
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
118
136
|
unless opt['rhlogin'] && opt['app'] && (opt['command'] || opt['embed'])
|
119
137
|
p_usage
|
120
138
|
end
|
@@ -187,7 +205,7 @@ response = RHC::http_post(@http, url, json_data, password)
|
|
187
205
|
|
188
206
|
if response.code == '200'
|
189
207
|
json_resp = JSON.parse(response.body)
|
190
|
-
RHC::print_response_success(json_resp,
|
208
|
+
RHC::print_response_success(json_resp, true)
|
191
209
|
else
|
192
|
-
RHC::print_response_err(response
|
210
|
+
RHC::print_response_err(response)
|
193
211
|
end
|
data/bin/rhc-snapshot
CHANGED
@@ -41,6 +41,7 @@ Pull down application snapshot for a user
|
|
41
41
|
-d|--debug Print Debug info
|
42
42
|
-h|--help Show Usage info
|
43
43
|
--config path Path of alternate config file
|
44
|
+
--timeout # Timeout, in seconds, for connection
|
44
45
|
|
45
46
|
USAGE
|
46
47
|
exit 255
|
@@ -55,7 +56,8 @@ begin
|
|
55
56
|
["--restore", "-r", GetoptLong::REQUIRED_ARGUMENT],
|
56
57
|
["--rhlogin", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
57
58
|
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
58
|
-
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT]
|
59
|
+
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
60
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
59
61
|
)
|
60
62
|
opt = {}
|
61
63
|
opts.each do |o, a|
|
@@ -80,6 +82,9 @@ end
|
|
80
82
|
if opt["debug"]
|
81
83
|
debug = true
|
82
84
|
end
|
85
|
+
RHC::debug(debug)
|
86
|
+
|
87
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
83
88
|
|
84
89
|
opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
|
85
90
|
|
data/bin/rhc-tail-files
CHANGED
@@ -42,6 +42,7 @@ Tail the logs of an application
|
|
42
42
|
-d|--debug Print Debug info
|
43
43
|
-h|--help Show Usage info
|
44
44
|
--config path Path of alternate config file
|
45
|
+
--timeout # Timeout, in seconds, for connection
|
45
46
|
|
46
47
|
USAGE
|
47
48
|
exit 255
|
@@ -56,7 +57,8 @@ begin
|
|
56
57
|
["--files", "-f", GetoptLong::REQUIRED_ARGUMENT],
|
57
58
|
["--rhlogin", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
58
59
|
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
59
|
-
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT]
|
60
|
+
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
61
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
60
62
|
)
|
61
63
|
opt = {}
|
62
64
|
opts.each do |o, a|
|
@@ -81,6 +83,9 @@ end
|
|
81
83
|
if opt['debug']
|
82
84
|
debug = true
|
83
85
|
end
|
86
|
+
RHC::debug(debug)
|
87
|
+
|
88
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
84
89
|
|
85
90
|
opt['rhlogin'] = get_var('default_rhlogin') unless opt['rhlogin']
|
86
91
|
|
@@ -93,7 +98,7 @@ if !password
|
|
93
98
|
password = RHC::get_password
|
94
99
|
end
|
95
100
|
|
96
|
-
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http,
|
101
|
+
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http, false)
|
97
102
|
|
98
103
|
app = opt['app']
|
99
104
|
|
data/bin/rhc-user-info
CHANGED
@@ -40,6 +40,7 @@ Display information about a user
|
|
40
40
|
-d|--debug Print Debug info
|
41
41
|
-h|--help Show Usage info
|
42
42
|
--config path Path of alternate config file
|
43
|
+
--timeout # Timeout, in seconds, for connection
|
43
44
|
|
44
45
|
USAGE
|
45
46
|
exit 255
|
@@ -53,7 +54,8 @@ begin
|
|
53
54
|
["--info", "-i", GetoptLong::NO_ARGUMENT],
|
54
55
|
["--rhlogin", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
55
56
|
["--config", GetoptLong::REQUIRED_ARGUMENT],
|
56
|
-
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT]
|
57
|
+
["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
58
|
+
["--timeout", GetoptLong::REQUIRED_ARGUMENT]
|
57
59
|
)
|
58
60
|
opt = {}
|
59
61
|
opts.each do |o, a|
|
@@ -78,6 +80,9 @@ end
|
|
78
80
|
if opt["debug"]
|
79
81
|
debug = true
|
80
82
|
end
|
83
|
+
RHC::debug(debug)
|
84
|
+
|
85
|
+
RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
|
81
86
|
|
82
87
|
opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
|
83
88
|
|
@@ -91,7 +96,7 @@ if !password
|
|
91
96
|
end
|
92
97
|
|
93
98
|
opt['apps'] = true if not opt['info'] and not opt['apps']
|
94
|
-
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http,
|
99
|
+
user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http, true)
|
95
100
|
|
96
101
|
if opt['info']
|
97
102
|
puts "User Info"
|
data/conf/express.conf
CHANGED
data/lib/rhc-common.rb
CHANGED
@@ -37,9 +37,25 @@ module RHC
|
|
37
37
|
Maxretries = 7
|
38
38
|
Defaultdelay = 2
|
39
39
|
API = "1.1.1"
|
40
|
+
@mytimeout = 10
|
41
|
+
@mydebug = false
|
40
42
|
broker_version = "?.?.?"
|
41
43
|
api_version = "?.?.?"
|
42
44
|
|
45
|
+
def self.timeout(val)
|
46
|
+
if val
|
47
|
+
@mytimeout = val.to_i
|
48
|
+
unless @mytimeout > 0
|
49
|
+
puts 'Timeout must be specified as a number greater than 0'
|
50
|
+
exit 254
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.debug(bool)
|
56
|
+
@mydebug = bool
|
57
|
+
end
|
58
|
+
|
43
59
|
def self.update_server_api_v(dict)
|
44
60
|
if !dict['broker'].nil? && (dict['broker'] =~ /\A\d+\.\d+\.\d+\z/)
|
45
61
|
broker_version = dict['broker']
|
@@ -59,21 +75,21 @@ module RHC
|
|
59
75
|
json
|
60
76
|
end
|
61
77
|
|
62
|
-
def self.get_cartridges_list(libra_server, net_http, cart_type="standalone",
|
78
|
+
def self.get_cartridges_list(libra_server, net_http, cart_type="standalone", print_result=nil)
|
63
79
|
puts "Contacting https://#{libra_server} to obtain list of cartridges..."
|
64
80
|
puts " (please excuse the delay)"
|
65
81
|
data = {'cart_type' => cart_type}
|
66
|
-
if
|
82
|
+
if @mydebug
|
67
83
|
data['debug'] = "true"
|
68
84
|
end
|
69
|
-
print_post_data(data
|
85
|
+
print_post_data(data)
|
70
86
|
json_data = generate_json(data)
|
71
87
|
|
72
88
|
url = URI.parse("https://#{libra_server}/broker/cartlist")
|
73
89
|
response = http_post(net_http, url, json_data, "none")
|
74
90
|
|
75
91
|
unless response.code == '200'
|
76
|
-
print_response_err(response
|
92
|
+
print_response_err(response)
|
77
93
|
return []
|
78
94
|
end
|
79
95
|
begin
|
@@ -83,7 +99,7 @@ module RHC
|
|
83
99
|
end
|
84
100
|
update_server_api_v(json_resp)
|
85
101
|
if print_result
|
86
|
-
print_response_success(json_resp
|
102
|
+
print_response_success(json_resp)
|
87
103
|
end
|
88
104
|
begin
|
89
105
|
carts = (JSON.parse(json_resp['data']))['carts']
|
@@ -93,8 +109,8 @@ module RHC
|
|
93
109
|
carts
|
94
110
|
end
|
95
111
|
|
96
|
-
def self.get_cartridge_listing(carts, sep, libra_server, net_http, cart_type="standalone",
|
97
|
-
carts = get_cartridges_list(libra_server, net_http, cart_type,
|
112
|
+
def self.get_cartridge_listing(carts, sep, libra_server, net_http, cart_type="standalone", print_result=nil)
|
113
|
+
carts = get_cartridges_list(libra_server, net_http, cart_type, print_result) if carts.nil?
|
98
114
|
carts.join(sep)
|
99
115
|
end
|
100
116
|
|
@@ -138,8 +154,8 @@ module RHC
|
|
138
154
|
true
|
139
155
|
end
|
140
156
|
|
141
|
-
def self.print_post_data(h
|
142
|
-
if (
|
157
|
+
def self.print_post_data(h)
|
158
|
+
if (@mydebug)
|
143
159
|
puts 'Submitting form:'
|
144
160
|
h.each do |k,v|
|
145
161
|
if k.to_s != 'password'
|
@@ -155,14 +171,14 @@ module RHC
|
|
155
171
|
end
|
156
172
|
end
|
157
173
|
|
158
|
-
def self.get_user_info(libra_server, rhlogin, password, net_http,
|
174
|
+
def self.get_user_info(libra_server, rhlogin, password, net_http, print_result, not_found_message=nil)
|
159
175
|
|
160
176
|
puts "Contacting https://#{libra_server}"
|
161
177
|
data = {'rhlogin' => rhlogin}
|
162
|
-
if
|
178
|
+
if @mydebug
|
163
179
|
data['debug'] = "true"
|
164
180
|
end
|
165
|
-
print_post_data(data
|
181
|
+
print_post_data(data)
|
166
182
|
json_data = generate_json(data)
|
167
183
|
|
168
184
|
url = URI.parse("https://#{libra_server}/broker/userinfo")
|
@@ -180,7 +196,7 @@ module RHC
|
|
180
196
|
puts "Invalid user credentials"
|
181
197
|
exit 97
|
182
198
|
else
|
183
|
-
print_response_err(response
|
199
|
+
print_response_err(response)
|
184
200
|
end
|
185
201
|
exit 254
|
186
202
|
end
|
@@ -191,7 +207,7 @@ module RHC
|
|
191
207
|
end
|
192
208
|
update_server_api_v(json_resp)
|
193
209
|
if print_result
|
194
|
-
print_response_success(json_resp
|
210
|
+
print_response_success(json_resp)
|
195
211
|
end
|
196
212
|
begin
|
197
213
|
user_info = JSON.parse(json_resp['data'].to_s)
|
@@ -219,7 +235,7 @@ module RHC
|
|
219
235
|
|
220
236
|
req.set_form_data({'json_data' => json_data, 'password' => password})
|
221
237
|
http = http.new(url.host, url.port)
|
222
|
-
http.open_timeout =
|
238
|
+
http.open_timeout = @mytimeout
|
223
239
|
if url.scheme == "https"
|
224
240
|
http.use_ssl = true
|
225
241
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
@@ -241,9 +257,9 @@ module RHC
|
|
241
257
|
end
|
242
258
|
end
|
243
259
|
|
244
|
-
def self.print_response_err(response
|
260
|
+
def self.print_response_err(response)
|
245
261
|
puts "Problem reported from server. Response code was #{response.code}."
|
246
|
-
if (
|
262
|
+
if (!@mydebug)
|
247
263
|
puts "Re-run with -d for more information."
|
248
264
|
end
|
249
265
|
exit_code = 254
|
@@ -251,11 +267,11 @@ module RHC
|
|
251
267
|
puts "JSON response:"
|
252
268
|
begin
|
253
269
|
json_resp = JSON.parse(response.body)
|
254
|
-
exit_code = print_json_body(json_resp
|
270
|
+
exit_code = print_json_body(json_resp)
|
255
271
|
rescue JSON::ParserError
|
256
272
|
exit_code = 254
|
257
273
|
end
|
258
|
-
elsif
|
274
|
+
elsif @mydebug
|
259
275
|
puts "HTTP response from server is #{response.body}"
|
260
276
|
end
|
261
277
|
exit exit_code.nil? ? 666 : exit_code
|
@@ -271,21 +287,21 @@ module RHC
|
|
271
287
|
end
|
272
288
|
end
|
273
289
|
|
274
|
-
def self.print_response_success(json_resp,
|
275
|
-
if
|
290
|
+
def self.print_response_success(json_resp, always_print_result=false)
|
291
|
+
if @mydebug
|
276
292
|
puts "Response from server:"
|
277
|
-
print_json_body(json_resp
|
293
|
+
print_json_body(json_resp)
|
278
294
|
elsif always_print_result
|
279
|
-
print_json_body(json_resp
|
295
|
+
print_json_body(json_resp)
|
280
296
|
else
|
281
297
|
print_response_messages(json_resp)
|
282
298
|
end
|
283
299
|
end
|
284
300
|
|
285
|
-
def self.print_json_body(json_resp
|
301
|
+
def self.print_json_body(json_resp)
|
286
302
|
print_response_messages(json_resp)
|
287
303
|
exit_code = json_resp['exit_code']
|
288
|
-
if
|
304
|
+
if @mydebug
|
289
305
|
if json_resp['debug']
|
290
306
|
puts ''
|
291
307
|
puts 'DEBUG:'
|
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: 297
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 79
|
9
|
+
- 5
|
10
|
+
version: 0.79.5
|
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: 2011-
|
18
|
+
date: 2011-10-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json_pure
|