foreman_rh_cloud 6.0.42 → 6.0.42.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3c56d7e23a70203868099896bbdcf3bb1b6ec31dc5a703a5da9bd147f849a10
4
- data.tar.gz: d6ea56a9abbc11fad5d4d77347d829a0eb3062af500b8773c9d617235ce0b0fc
3
+ metadata.gz: 38d6287736ecb0fe82ecd3506ba7a5c638b0359976c9948ace0e5d7fc1cda5b8
4
+ data.tar.gz: 650285b17a358808f0e8d79bdb239a310b0468dff592848a390bd3201a5f6369
5
5
  SHA512:
6
- metadata.gz: 523354ddf7e4511663d53833823b0e5ffa3128ea9513eeab23b458e23d6f5a76254017ffc52b8f513245f8404e991154123585bc93269f1b72c06ec7512e595a
7
- data.tar.gz: '03784d6b78c2acf11b084912739cb5714e95f165871db256a260da8aab1e3c3d278eb8120eb2aec673477467da611a02f4ac89b87ed4b60b099a27d51e3c0e5b'
6
+ metadata.gz: 140f8b1c56d18863d22d97c8195b08f1f264b8b3ed2ead351c1f78d5b9b9eb779505cfe913b7c9360153f4bfb0c1c356c1e179e70211a3cf277b0bc47c7fcfc1
7
+ data.tar.gz: 1b6a57cda764598e8a2a82567c8cc2cd653af3dc6af0e950ce3adca8b6961235e3b1057a4f4fbd8ae173db9b0515c1b97c8c3b4f272e4b96d8ff499bdcdac250
@@ -33,10 +33,6 @@ module InsightsCloud::Api
33
33
  }, status: @cloud_response.code
34
34
  end
35
35
 
36
- if @cloud_response.headers[:content_disposition]
37
- return send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
38
- end
39
-
40
36
  # Append redhat-specific headers
41
37
  @cloud_response.headers.each do |key, value|
42
38
  assign_header(response, @cloud_response, key, false) if key.to_s.start_with?('x_rh_')
@@ -45,7 +41,17 @@ module InsightsCloud::Api
45
41
  assign_header(response, @cloud_response, :x_resource_count, true)
46
42
  headers[Rack::ETAG] = @cloud_response.headers[:etag]
47
43
 
48
- render json: @cloud_response, status: @cloud_response.code
44
+ if @cloud_response.headers[:content_disposition]
45
+ # If there is a Content-Disposition header, it means we are forwarding binary data, send the raw data with proper
46
+ # content type
47
+ send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
48
+ elsif @cloud_response.headers[:content_type] =~ /zip/
49
+ # if there is no Content-Disposition, but the content type is binary according the content type,
50
+ # forward the request as binry too
51
+ send_data @cloud_response, type: @cloud_response.headers[:content_type]
52
+ else
53
+ render json: @cloud_response, status: @cloud_response.code
54
+ end
49
55
  end
50
56
 
51
57
  def branch_info
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '6.0.42'.freeze
2
+ VERSION = '6.0.42.1'.freeze
3
3
  end
@@ -11,7 +11,7 @@ module InventorySync
11
11
  @per_page = result['per_page']
12
12
  @sub_ids = result["results"].map { |host| host['subscription_manager_id'] }
13
13
  @uuid_by_sub_id = Hash[result["results"].map { |host| [host['subscription_manager_id'], host['id']] }]
14
- @uuid_by_fqdn = Hash[result["results"].map { |host| [host['fqdn'].downcase, host['id']] }]
14
+ @uuid_by_fqdn = Hash[result["results"].map { |host| [host['fqdn']&.downcase, host['id']] }]
15
15
  end
16
16
 
17
17
  def status_hashes
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "6.0.42",
3
+ "version": "6.0.42.1",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -72,6 +72,17 @@ module InsightsCloud::Api
72
72
  assert_equal etag, @response.headers[Rack::ETAG]
73
73
  end
74
74
 
75
+ test "should set content type header to response from cloud" do
76
+ req = RestClient::Request.new(:method => 'GET', :url => 'http://test.theforeman.org')
77
+ net_http_resp = Net::HTTPResponse.new(1.0, 200, "OK")
78
+ net_http_resp[:content_type] = 'application/zip'
79
+ res = RestClient::Response.create(@body, net_http_resp, req)
80
+ ::ForemanRhCloud::CloudRequestForwarder.any_instance.stubs(:forward_request).returns(res)
81
+
82
+ get :forward_request, params: { "path" => "static/v1/release/insights-core.egg" }
83
+ assert_equal net_http_resp[:content_type], @response.headers['Content-Type']
84
+ end
85
+
75
86
  test "should handle failed authentication to cloud" do
76
87
  net_http_resp = Net::HTTPResponse.new(1.0, 401, "Unauthorized")
77
88
  res = RestClient::Response.create(@body, net_http_resp, @http_req)
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: 6.0.42
4
+ version: 6.0.42.1
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: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2022-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello