foreman_rh_cloud 4.0.25.1 → 4.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +4 -1
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +8 -0
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +14 -2
- data/config/Gemfile.lock.gh_test +169 -152
- data/config/database.yml.example +2 -2
- data/config/package-lock.json +41822 -0
- data/config/routes.rb +1 -1
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -0
- data/lib/foreman_inventory_upload/generators/tags.rb +9 -3
- data/lib/foreman_rh_cloud/engine.rb +2 -0
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +12 -1
- data/lib/insights_cloud/async/insights_client_status_aging.rb +4 -0
- data/lib/insights_cloud/async/insights_full_sync.rb +4 -0
- data/lib/insights_cloud/async/insights_generate_notifications.rb +4 -0
- data/lib/insights_cloud/async/insights_resolutions_sync.rb +7 -2
- data/lib/insights_cloud/async/insights_rules_sync.rb +10 -2
- data/lib/inventory_sync/async/host_result.rb +0 -5
- data/lib/inventory_sync/async/inventory_full_sync.rb +18 -9
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +6 -6
- data/lib/inventory_sync/async/inventory_scheduled_sync.rb +4 -0
- data/lib/inventory_sync/async/inventory_self_host_sync.rb +4 -0
- data/lib/inventory_sync/async/query_inventory_job.rb +4 -0
- data/package.json +2 -2
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +16 -39
- data/test/factories/inventory_upload_factories.rb +14 -0
- data/test/jobs/insights_resolutions_sync_test.rb +10 -1
- data/test/jobs/inventory_full_sync_test.rb +28 -2
- data/test/jobs/inventory_hosts_sync_test.rb +15 -0
- data/test/unit/foreman_rh_cloud_self_host_test.rb +28 -0
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +26 -0
- data/test/unit/slice_generator_test.rb +36 -4
- data/test/unit/tags_generator_test.rb +31 -16
- data/webpack/InsightsCloudSync/Components/InsightsHeader/index.js +0 -2
- data/webpack/InsightsCloudSync/Components/InsightsSettings/insightsSettings.scss +1 -0
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/InsightsHeader.test.js.snap +0 -1
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +2 -0
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +1 -0
- data/webpack/common/Switcher/HelpLabel.js +1 -1
- data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d30780fe6dc3c0b25146d8c8b5549179516218ebbf8cfcaa02aa704ee24d9f62
|
4
|
+
data.tar.gz: 3a0c1d673a773487565e26493f34fe88dd91f5b7a27f15fa6b532b8ef7a2eb58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80e8f58e6cb5572796af39e096163f151fa1636b92064ab239f16fc439dee10e25c6cf7be17f046670424dcdf2c799fcc497be964585e96ef51070154fe6c6a6
|
7
|
+
data.tar.gz: 3233f24be9b101917d12367e6649edf96e52e705db61de109f04a82ac13369018dbdca536bd2b400ed56a23971aaeceb04905b18f80220f8fe702181403c941b
|
@@ -7,6 +7,7 @@ module Api
|
|
7
7
|
include InventoryUpload::TaskActions
|
8
8
|
|
9
9
|
api :GET, "/organizations/:organization_id/rh_cloud/report", N_("Download latest report")
|
10
|
+
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
|
10
11
|
def download_file
|
11
12
|
filename, file = report_file(params[:organization_id])
|
12
13
|
|
@@ -16,6 +17,7 @@ module Api
|
|
16
17
|
end
|
17
18
|
|
18
19
|
api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
|
20
|
+
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
|
19
21
|
def generate_report
|
20
22
|
organization_id = params[:organization_id]
|
21
23
|
|
@@ -27,6 +29,7 @@ module Api
|
|
27
29
|
end
|
28
30
|
|
29
31
|
api :POST, "/organizations/:organization_id/rh_cloud/inventory_sync", N_("Start inventory synchronization")
|
32
|
+
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
|
30
33
|
def sync_inventory_status
|
31
34
|
selected_org = Organization.find(params[:organization_id])
|
32
35
|
|
@@ -39,7 +42,7 @@ module Api
|
|
39
42
|
render json: { message: error.message }, status: :bad_request
|
40
43
|
end
|
41
44
|
|
42
|
-
api :POST, "rh_cloud/enable_connector", N_("Enable cloud connector")
|
45
|
+
api :POST, "/rh_cloud/enable_connector", N_("Enable cloud connector")
|
43
46
|
def enable_cloud_connector
|
44
47
|
cloud_connector = ForemanRhCloud::CloudConnector.new
|
45
48
|
render json: cloud_connector.install.to_json
|
@@ -25,6 +25,14 @@ module InsightsCloud::Api
|
|
25
25
|
}, status: :bad_gateway
|
26
26
|
end
|
27
27
|
|
28
|
+
if @cloud_response.code >= 300
|
29
|
+
return render json: {
|
30
|
+
:message => 'Cloud request failed',
|
31
|
+
:headers => {},
|
32
|
+
:response => @cloud_response,
|
33
|
+
}, status: @cloud_response.code
|
34
|
+
end
|
35
|
+
|
28
36
|
if @cloud_response.headers[:content_disposition]
|
29
37
|
return send_data @cloud_response, disposition: @cloud_response.headers[:content_disposition], type: @cloud_response.headers[:content_type]
|
30
38
|
end
|
@@ -17,6 +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
22
|
end
|
21
23
|
|
22
24
|
def prepare_request_opts(original_request, forward_payload, forward_params, certs)
|
@@ -62,6 +64,12 @@ module ForemanRhCloud
|
|
62
64
|
ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
|
63
65
|
ssl_client_key: OpenSSL::PKey::RSA.new(certs[:key]),
|
64
66
|
}
|
67
|
+
when connection_test_request?
|
68
|
+
{
|
69
|
+
url: ForemanRhCloud.cert_base_url + '/api/apicast-tests/ping',
|
70
|
+
ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
|
71
|
+
ssl_client_key: OpenSSL::PKey::RSA.new(certs[:key]),
|
72
|
+
}
|
65
73
|
else # Legacy insights API
|
66
74
|
{
|
67
75
|
url: ForemanRhCloud.legacy_insights_url + request_path.sub('/redhat_access/r/insights', '/r/insights'),
|
@@ -76,6 +84,10 @@ module ForemanRhCloud
|
|
76
84
|
->(request_path) { request_path.include? '/platform' }
|
77
85
|
end
|
78
86
|
|
87
|
+
def connection_test_request?
|
88
|
+
->(request_path) { request_path =~ /redhat_access\/r\/insights\/?$/ }
|
89
|
+
end
|
90
|
+
|
79
91
|
def prepare_forward_cloud_url(base_url, request_path)
|
80
92
|
cloud_path = request_path.sub('/redhat_access/r/insights/platform/', '')
|
81
93
|
.sub('/redhat_access/r/insights/', '')
|
@@ -84,11 +96,11 @@ module ForemanRhCloud
|
|
84
96
|
end
|
85
97
|
|
86
98
|
def core_app_name
|
87
|
-
|
99
|
+
BranchInfo.new.core_app_name
|
88
100
|
end
|
89
101
|
|
90
102
|
def core_app_version
|
91
|
-
|
103
|
+
BranchInfo.new.core_app_version
|
92
104
|
end
|
93
105
|
|
94
106
|
def http_user_agent(original_request)
|