foreman_rh_cloud 10.0.4 → 10.0.5
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.
- checksums.yaml +4 -4
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +2 -0
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +2 -2
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfabc05d2ec5effb2a007e85471ba31e9d0067495fcbf52d07bb37b4f3c1a15c
|
4
|
+
data.tar.gz: c5f0db2ca590193d014d69358882c0abf98adf523158ceec65536391b454ca23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd794c63904449ceb0f7b4b2d02de6e8b97cdde7745c24a5d6a02d52047fc036d3b995e11bca5aa0cf241a8b2def0f6efda15e810cd2dfdb9a5060e1cfe984bf
|
7
|
+
data.tar.gz: 73d24b976d3a00150696e403d5bd5f134faa1c60ca8b75063a0ac12e57da85427c6a301faf96d502e736f515c60e6bb6b25627c056909698b3fe9fac17751da7
|
@@ -18,6 +18,8 @@ module InsightsCloud::Api
|
|
18
18
|
certs = candlepin_id_cert @organization
|
19
19
|
@cloud_response = ::ForemanRhCloud::CloudRequestForwarder.new.forward_request(request, controller_name, @branch_id, certs)
|
20
20
|
|
21
|
+
return render json: { message: @cloud_response.to_s }, status: :gateway_timeout if @cloud_response.is_a?(RestClient::Exceptions::OpenTimeout)
|
22
|
+
|
21
23
|
if @cloud_response.code == 401
|
22
24
|
return render json: {
|
23
25
|
:message => 'Authentication to the Insights Service failed.',
|
@@ -17,8 +17,8 @@ module ForemanRhCloud
|
|
17
17
|
logger.debug("Sending request to: #{request_opts[:url]}")
|
18
18
|
|
19
19
|
execute_cloud_request(request_opts)
|
20
|
-
rescue RestClient::
|
21
|
-
error_response.response
|
20
|
+
rescue RestClient::ExceptionWithResponse => error_response
|
21
|
+
error_response.response.presence || error_response.exception
|
22
22
|
end
|
23
23
|
|
24
24
|
def prepare_request_opts(original_request, forward_payload, forward_params, certs)
|
data/package.json
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'test_plugin_helper'
|
2
|
+
require 'rest-client'
|
2
3
|
|
3
4
|
module InsightsCloud::Api
|
4
5
|
class MachineTelemetriesControllerTest < ActionController::TestCase
|
@@ -33,6 +34,18 @@ module InsightsCloud::Api
|
|
33
34
|
assert_equal @body, @response.body
|
34
35
|
end
|
35
36
|
|
37
|
+
test "should handle timeout from cloud" do
|
38
|
+
::ForemanRhCloud::CloudRequestForwarder.any_instance.
|
39
|
+
stubs(:forward_request).
|
40
|
+
raises(RestClient::Exceptions::OpenTimeout.new("Timed out connecting to server"))
|
41
|
+
|
42
|
+
get :forward_request, params: { "path" => "platform/module-update-router/v1/channel" }
|
43
|
+
request_response = JSON.parse(@response.body)
|
44
|
+
# I can't get @response.status to take a nil value so I'm not asserting for that
|
45
|
+
|
46
|
+
assert_equal 'Timed out connecting to server', request_response['error']
|
47
|
+
end
|
48
|
+
|
36
49
|
test "should respond with the same content type" do
|
37
50
|
net_http_resp = Net::HTTPResponse.new(1.0, 200, "OK")
|
38
51
|
net_http_resp.add_field 'Set-Cookie', 'Monster'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0.
|
4
|
+
version: 10.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foreman_ansible
|