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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8215c5bc0f5e21d7c4ee1b09ee2a38a44bc17d36c95606d77e8ee2cffc10d2e
4
- data.tar.gz: f42e8b38e3f996cf29973a776ec03083aaa8db1fb58639690f7a50048c531260
3
+ metadata.gz: bfabc05d2ec5effb2a007e85471ba31e9d0067495fcbf52d07bb37b4f3c1a15c
4
+ data.tar.gz: c5f0db2ca590193d014d69358882c0abf98adf523158ceec65536391b454ca23
5
5
  SHA512:
6
- metadata.gz: bd2acf961ce05b7043013b695dccaab5d764d526b23aef83adc85373a0699fdc9a161bbd65c621d5fffc9139f254e88b6e6e53e2da9e5da6ade0330523c85f0b
7
- data.tar.gz: 380d55213867c915d707f52470f6ec3aca269c3f2aa7bfc1aa2ba2db7659806c3c17824675fe5c9b2ef62df9704f0fb09f0cc2738bab17ea5339edd7c832dbad
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::Exception => error_response
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)
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '10.0.4'.freeze
2
+ VERSION = '10.0.5'.freeze
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "10.0.4",
3
+ "version": "10.0.5",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
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-03-04 00:00:00.000000000 Z
11
+ date: 2025-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman_ansible