foreman_rh_cloud 12.1.0 → 12.1.2
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/README.md +7 -4
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +26 -22
- data/app/services/foreman_rh_cloud/cloud_request.rb +9 -3
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +0 -2
- data/app/views/api/v2/hosts/insights/single.rabl +5 -0
- data/config/package-lock.json.plugin +4137 -3036
- data/config/routes.rb +1 -0
- data/lib/foreman_rh_cloud/engine.rb +11 -4
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_vulnerability.rb +2 -0
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +35 -2
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +17 -0
- data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +18 -0
- data/webpack/CVEsHostDetailsTab/index.js +3 -0
- data/webpack/ForemanInventoryUpload/Components/InventorySettings/MinimalInventoryDropdown.js +1 -1
- data/webpack/ForemanRhCloudFills.js +11 -1
- data/webpack/ForemanRhCloudHelpers.js +3 -0
- data/webpack/ForemanRhCloudPages.js +7 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsLabel.js +40 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsSection.js +30 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsSection.scss +25 -0
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +4 -6
- data/webpack/InsightsVulnerability/InsightsVulnerability.js +13 -0
- data/webpack/InsightsVulnerability/InsightsVulnerability.test.js +18 -0
- data/webpack/__tests__/ForemanRhCloudHelpers.test.js +30 -1
- data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +10 -0
- metadata +11 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca9c35b5c31e2f8d00889ae5c4f57a3245e038f2ff106e708c9f45909e1340d2
|
4
|
+
data.tar.gz: 7b151bcccb350ff1cb748aeca126656d8e7e2712e7878ea0522b7db719c6594f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec35e323ea4ff1e5af20ee9a6185c83f5cf43e011a1f4879d696050381265c474cbf2b1435f72f53e43c785c797f5de013513f7efbf49e19fd87b9d2c58fe279
|
7
|
+
data.tar.gz: 109928813b8f2e70ee7107d44470e04fff2fad1e9fd356f2b15f7f57092bb06c003277de931c5d5dfa84a4a379de36e4e14fd7ea2898b3070d310c4c7311e5c0
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
[](https://github.com/theforeman/foreman_rh_cloud/actions/workflows/ruby_tests.yml)
|
2
|
+
[](https://github.com/theforeman/foreman_rh_cloud/actions/workflows/js_tests.yml)
|
3
|
+
|
1
4
|
# ForemanRhCloud
|
2
5
|
|
3
|
-
*
|
6
|
+
*Introduction here*
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -15,7 +18,7 @@ for how to install Foreman plugins
|
|
15
18
|
|
16
19
|
#### Inventory upload
|
17
20
|
|
18
|
-
In UI:
|
21
|
+
In UI: Insights -> Inventory Upload -> select the organization -> Generate and upload report
|
19
22
|
|
20
23
|
From command-line:
|
21
24
|
|
@@ -38,7 +41,7 @@ From command-line:
|
|
38
41
|
|
39
42
|
#### Fetch hosts remediation data
|
40
43
|
|
41
|
-
In UI:
|
44
|
+
In UI: Insights -> Recommendations -> Sync recommendations (under the vertical ellipsis)
|
42
45
|
|
43
46
|
From command-line:
|
44
47
|
|
@@ -46,7 +49,7 @@ From command-line:
|
|
46
49
|
|
47
50
|
#### Synchronize inventory status
|
48
51
|
|
49
|
-
In UI:
|
52
|
+
In UI: Insights -> Inventory Upload -> Sync all inventory status
|
50
53
|
|
51
54
|
From command-line:
|
52
55
|
|
@@ -18,35 +18,39 @@ module InsightsCloud::Api
|
|
18
18
|
certs = candlepin_id_cert @organization
|
19
19
|
begin
|
20
20
|
@cloud_response = ::ForemanRhCloud::CloudRequestForwarder.new.forward_request(request, controller_name, @branch_id, certs)
|
21
|
-
rescue RestClient::
|
22
|
-
|
23
|
-
return render json: { error:
|
24
|
-
rescue RestClient::
|
25
|
-
logger.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
rescue RestClient::Exceptions::Timeout => e
|
22
|
+
response_obj = e.response.presence || e.exception
|
23
|
+
return render json: { message: response_obj.to_s, error: response_obj.to_s }, status: :gateway_timeout
|
24
|
+
rescue RestClient::Unauthorized => e
|
25
|
+
logger.warn("Forwarding request auth error: #{e}")
|
26
|
+
message = 'Authentication to the Insights Service failed.'
|
27
|
+
return render json: { message: message, error: message }, status: :unauthorized
|
28
|
+
rescue RestClient::NotModified => e
|
29
|
+
logger.info("Forwarding request not modified: #{e}")
|
30
|
+
message = 'Cloud request not modified'
|
31
|
+
return render json: { message: message, error: message }, status: :not_modified
|
32
|
+
rescue RestClient::ExceptionWithResponse => e
|
33
|
+
response_obj = e.response.presence || e.exception
|
34
|
+
code = response_obj.try(:code) || response_obj.try(:http_code) || 500
|
35
|
+
message = 'Cloud request failed'
|
30
36
|
|
31
|
-
if @cloud_response.code == 401
|
32
37
|
return render json: {
|
33
|
-
:message =>
|
38
|
+
:message => message,
|
39
|
+
:error => response_obj.to_s,
|
34
40
|
:headers => {},
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
:headers => {},
|
42
|
-
:response => @cloud_response,
|
43
|
-
}, status: @cloud_response.code
|
41
|
+
:response => response_obj,
|
42
|
+
}, status: code
|
43
|
+
rescue StandardError => e
|
44
|
+
# Catch any other exceptions here, such as Errno::ECONNREFUSED
|
45
|
+
logger.warn("Cloud request failed with exception: #{e}")
|
46
|
+
return render json: { error: e.to_s }, status: :bad_gateway
|
44
47
|
end
|
45
48
|
|
46
49
|
# Append redhat-specific headers
|
47
50
|
@cloud_response.headers.each do |key, value|
|
48
51
|
assign_header(response, @cloud_response, key, false) if key.to_s.start_with?('x_rh_')
|
49
52
|
end
|
53
|
+
|
50
54
|
# Append general headers
|
51
55
|
assign_header(response, @cloud_response, :x_resource_count, true)
|
52
56
|
headers[Rack::ETAG] = @cloud_response.headers[:etag]
|
@@ -56,8 +60,8 @@ module InsightsCloud::Api
|
|
56
60
|
# content type
|
57
61
|
send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
|
58
62
|
elsif @cloud_response.headers[:content_type] =~ /zip/
|
59
|
-
#
|
60
|
-
#
|
63
|
+
# If there is no Content-Disposition, but the content type is binary according to Content-Type, send the raw data
|
64
|
+
# with proper content type
|
61
65
|
send_data @cloud_response, type: @cloud_response.headers[:content_type]
|
62
66
|
else
|
63
67
|
render json: @cloud_response, status: @cloud_response.code
|
@@ -17,9 +17,15 @@ module ForemanRhCloud
|
|
17
17
|
logger.debug("Response headers for request url #{final_params[:url]} are: #{response.headers}")
|
18
18
|
|
19
19
|
response
|
20
|
-
rescue RestClient::
|
21
|
-
logger.debug("
|
22
|
-
raise
|
20
|
+
rescue RestClient::Exceptions::Timeout => ex
|
21
|
+
logger.debug("Timeout exception raised for request url #{final_params[:url]}: #{ex}")
|
22
|
+
raise
|
23
|
+
rescue RestClient::ExceptionWithResponse => ex
|
24
|
+
logger.debug("Response headers for request url #{final_params[:url]} with status code #{ex.http_code} are: #{ex.http_headers} and body: #{ex.http_body}")
|
25
|
+
raise
|
26
|
+
rescue StandardError => ex
|
27
|
+
logger.debug("Exception raised for request url #{final_params[:url]}: #{ex}")
|
28
|
+
raise
|
23
29
|
end
|
24
30
|
end
|
25
31
|
end
|
@@ -17,8 +17,6 @@ module ForemanRhCloud
|
|
17
17
|
logger.debug("Sending request to: #{request_opts[:url]}")
|
18
18
|
|
19
19
|
execute_cloud_request(request_opts)
|
20
|
-
rescue RestClient::ExceptionWithResponse => error_response
|
21
|
-
error_response.response.presence || error_response.exception
|
22
20
|
end
|
23
21
|
|
24
22
|
def prepare_request_opts(original_request, forward_payload, forward_params, certs)
|