foreman_rh_cloud 3.0.33 → 4.0.21.1
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/foreman_inventory_upload/reports_controller.rb +1 -3
- data/app/controllers/foreman_inventory_upload/tasks_controller.rb +13 -5
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +4 -4
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +7 -29
- data/app/controllers/insights_cloud/hits_controller.rb +3 -7
- data/app/models/insights_client_report_status.rb +22 -11
- data/app/services/foreman_rh_cloud/cloud_auth.rb +0 -16
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +17 -27
- data/app/services/foreman_rh_cloud/remediations_retriever.rb +4 -6
- data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +9 -0
- data/config/Gemfile.lock.gh_test +95 -93
- data/config/database.yml.example +2 -2
- data/config/routes.rb +1 -20
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +1 -22
- data/lib/foreman_inventory_upload/generators/queries.rb +0 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +5 -6
- data/lib/foreman_inventory_upload/generators/tags.rb +2 -11
- data/lib/foreman_inventory_upload.rb +1 -9
- data/lib/foreman_rh_cloud/engine.rb +10 -17
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +1 -12
- data/lib/insights_cloud/async/insights_full_sync.rb +14 -9
- data/lib/insights_cloud/async/insights_resolutions_sync.rb +6 -13
- data/lib/insights_cloud/async/insights_rules_sync.rb +9 -13
- data/lib/inventory_sync/async/host_result.rb +5 -4
- data/lib/inventory_sync/async/inventory_full_sync.rb +10 -21
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +3 -18
- data/lib/inventory_sync/async/inventory_scheduled_sync.rb +0 -12
- data/lib/inventory_sync/async/query_inventory_job.rb +5 -6
- data/lib/tasks/insights.rake +0 -15
- data/lib/tasks/rh_cloud_inventory.rake +1 -8
- data/package.json +3 -3
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +0 -41
- data/test/factories/inventory_upload_factories.rb +1 -1
- data/test/jobs/insights_full_sync_test.rb +0 -1
- data/test/jobs/insights_resolutions_sync_test.rb +1 -11
- data/test/jobs/insights_rules_sync_test.rb +0 -1
- data/test/jobs/inventory_full_sync_test.rb +2 -38
- data/test/models/insights_client_report_status_test.rb +72 -70
- data/test/test_plugin_helper.rb +0 -55
- data/test/unit/fact_helpers_test.rb +2 -2
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +3 -21
- data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +0 -1
- data/test/unit/slice_generator_test.rb +27 -70
- data/test/unit/tags_generator_test.rb +0 -56
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +0 -11
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +0 -11
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +63 -28
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +3 -2
- data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableActions.js +19 -19
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTableActions.test.js.snap +14 -14
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +0 -1
- data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +0 -14
- data/webpack/InsightsCloudSync/Components/__tests__/__snapshots__/NoTokenEmptyState.test.js.snap +13 -20
- data/webpack/InsightsCloudSync/InsightsCloudSync.js +1 -4
- data/webpack/InsightsCloudSync/InsightsCloudSyncActions.js +20 -44
- data/webpack/InsightsCloudSync/InsightsCloudSyncConstants.js +0 -2
- data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +2 -2
- data/webpack/InsightsCloudSync/__tests__/__snapshots__/InsightsCloudSyncActions.test.js.snap +7 -11
- metadata +4 -32
- data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +0 -50
- data/app/controllers/concerns/inventory_upload/report_actions.rb +0 -26
- data/app/controllers/concerns/inventory_upload/task_actions.rb +0 -25
- data/app/helpers/foreman_insights_deprecations_helper.rb +0 -9
- data/app/helpers/foreman_insights_host_helper.rb +0 -19
- data/app/overrides/old_plugin_deprecation.rb +0 -20
- data/app/services/foreman_rh_cloud/cloud_request.rb +0 -14
- data/app/services/foreman_rh_cloud/insights_status_cleaner.rb +0 -17
- data/config/package-lock.json.plugin +0 -32774
- data/db/migrate/20210720000001_remove_old_insights_statuses.foreman_rh_cloud.rb +0 -6
- data/lib/insights_cloud/async/insights_client_status_aging.rb +0 -23
- data/lib/inventory_sync/async/inventory_self_host_sync.rb +0 -39
- data/test/controllers/inventory_upload/api/inventory_controller_test.rb +0 -53
- data/test/jobs/insights_client_status_aging_test.rb +0 -33
- data/test/jobs/inventory_hosts_sync_test.rb +0 -283
- data/test/jobs/inventory_scheduled_sync_test.rb +0 -22
- data/test/jobs/inventory_self_host_sync_test.rb +0 -104
- data/test/unit/foreman_rh_cloud_self_host_test.rb +0 -28
- data/test/unit/services/foreman_rh_cloud/insights_status_cleaner_test.rb +0 -31
- data/webpack/common/ForemanTasks/ForemanTasksActions.js +0 -64
- data/webpack/common/ForemanTasks/ForemanTasksHelpers.js +0 -7
- data/webpack/common/ForemanTasks/index.js +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
module Api
|
|
2
|
-
module V2
|
|
3
|
-
module RhCloud
|
|
4
|
-
class InventoryController < ::Api::V2::BaseController
|
|
5
|
-
include ::Api::Version2
|
|
6
|
-
include InventoryUpload::ReportActions
|
|
7
|
-
include InventoryUpload::TaskActions
|
|
8
|
-
|
|
9
|
-
api :GET, "/organizations/:organization_id/rh_cloud/report", N_("Download latest report")
|
|
10
|
-
def download_file
|
|
11
|
-
filename, file = report_file(params[:organization_id])
|
|
12
|
-
|
|
13
|
-
send_file file, disposition: 'attachment', filename: filename
|
|
14
|
-
rescue InventoryUpload::ReportActions::ReportMissingError => error
|
|
15
|
-
render json: { message: error.message }, status: :not_found
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
|
|
19
|
-
def generate_report
|
|
20
|
-
organization_id = params[:organization_id]
|
|
21
|
-
|
|
22
|
-
start_report_generation(organization_id)
|
|
23
|
-
|
|
24
|
-
render json: {
|
|
25
|
-
action_status: 'success',
|
|
26
|
-
}, status: :ok
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
api :POST, "/organizations/:organization_id/rh_cloud/inventory_sync", N_("Start inventory synchronization")
|
|
30
|
-
def sync_inventory_status
|
|
31
|
-
selected_org = Organization.find(params[:organization_id])
|
|
32
|
-
|
|
33
|
-
task = start_inventory_sync(selected_org)
|
|
34
|
-
|
|
35
|
-
render json: {
|
|
36
|
-
task: task,
|
|
37
|
-
}, status: :ok
|
|
38
|
-
rescue InventoryUpload::TaskActions::NothingToSyncError => error
|
|
39
|
-
render json: { message: error.message }, status: :bad_request
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
api :POST, "rh_cloud/enable_connector", N_("Enable cloud connector")
|
|
43
|
-
def enable_cloud_connector
|
|
44
|
-
cloud_connector = ForemanRhCloud::CloudConnector.new
|
|
45
|
-
render json: cloud_connector.install.to_json
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module InventoryUpload
|
|
2
|
-
module ReportActions
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
class ReportMissingError < Foreman::Exception
|
|
6
|
-
MESSAGE = N_("The report file %{filename} doesn't exist")
|
|
7
|
-
|
|
8
|
-
def initialize(**params)
|
|
9
|
-
super(self.class::MESSAGE % params, params)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def start_report_generation(organization_id)
|
|
14
|
-
ForemanInventoryUpload::Async::GenerateReportJob.perform_later(ForemanInventoryUpload.generated_reports_folder, organization_id)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def report_file(organization_id)
|
|
18
|
-
filename = ForemanInventoryUpload.facts_archive_name(organization_id)
|
|
19
|
-
files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]
|
|
20
|
-
|
|
21
|
-
raise ReportMissingError.new(filename: filename) if files.empty?
|
|
22
|
-
|
|
23
|
-
[filename, files.first]
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module InventoryUpload
|
|
2
|
-
module TaskActions
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
class NothingToSyncError < Foreman::Exception
|
|
6
|
-
MESSAGE = N_('Nothing to sync, there are no hosts with subscription for this organization.')
|
|
7
|
-
|
|
8
|
-
def initialize(**params)
|
|
9
|
-
super(self.class::MESSAGE, params)
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def start_inventory_sync(selected_org)
|
|
14
|
-
subscribed_hosts = ForemanInventoryUpload::Generators::Queries.for_slice(
|
|
15
|
-
Host.unscoped.where(organization: selected_org)
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
if subscribed_hosts.empty?
|
|
19
|
-
raise NothingToSyncError
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
ForemanTasks.async_task(InventorySync::Async::InventoryFullSync, selected_org)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
module ForemanInsightsDeprecationsHelper
|
|
2
|
-
def old_plugin_deprecation_warning
|
|
3
|
-
alert(
|
|
4
|
-
class: 'alert-warning',
|
|
5
|
-
close: false,
|
|
6
|
-
text: _('redhat_access plugin is deprecated and will be removed in Satellite 6.10. You can find recommendations for your hosts on hosts index and details pages.')
|
|
7
|
-
)
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module ForemanInsightsHostHelper
|
|
2
|
-
def insights_host_overview_buttons(host)
|
|
3
|
-
search_condition = "hostname=#{host.fqdn}"
|
|
4
|
-
[
|
|
5
|
-
{
|
|
6
|
-
button: link_to_if_authorized(
|
|
7
|
-
_("Recommendations"),
|
|
8
|
-
hash_for_foreman_rh_cloud_insights_cloud_path(
|
|
9
|
-
search: search_condition,
|
|
10
|
-
select_all: true
|
|
11
|
-
),
|
|
12
|
-
title: _("Host Insights recommendations"),
|
|
13
|
-
class: 'btn btn-default'
|
|
14
|
-
),
|
|
15
|
-
priority: 1000,
|
|
16
|
-
},
|
|
17
|
-
]
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Deface::Override.new(
|
|
2
|
-
virtual_path: 'redhat_access/analytics_dashboard/welcome',
|
|
3
|
-
name: 'deprecation_warning',
|
|
4
|
-
insert_before: 'div#welcome',
|
|
5
|
-
text: '<%= old_plugin_deprecation_warning %>'
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
Deface::Override.new(
|
|
9
|
-
virtual_path: 'redhat_access/analytics_dashboard/index',
|
|
10
|
-
name: 'deprecation_warning_index_not_met',
|
|
11
|
-
insert_before: 'article#content',
|
|
12
|
-
text: '<%= old_plugin_deprecation_warning %>'
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
Deface::Override.new(
|
|
16
|
-
virtual_path: 'redhat_access/analytics_dashboard/index',
|
|
17
|
-
name: 'deprecation_warning_index_met',
|
|
18
|
-
insert_before: 'div.main-content',
|
|
19
|
-
text: '<%= old_plugin_deprecation_warning %>'
|
|
20
|
-
)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
module ForemanRhCloud
|
|
2
|
-
module CloudRequest
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
def execute_cloud_request(params)
|
|
6
|
-
final_params = {
|
|
7
|
-
verify_ssl: ForemanRhCloud.verify_ssl_method,
|
|
8
|
-
proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
|
|
9
|
-
}.deep_merge(params)
|
|
10
|
-
|
|
11
|
-
RestClient::Request.execute(final_params)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module ForemanRhCloud
|
|
2
|
-
class InsightsStatusCleaner
|
|
3
|
-
def clean(host_search)
|
|
4
|
-
host_ids = Host.search_for(host_search).pluck(:id)
|
|
5
|
-
|
|
6
|
-
# delete all insights status records for the hosts
|
|
7
|
-
deleted_count = InsightsClientReportStatus.where(host_id: host_ids).delete_all
|
|
8
|
-
|
|
9
|
-
# refresh global status
|
|
10
|
-
Host.where(id: host_ids).preload(:host_statuses).find_in_batches do |hosts|
|
|
11
|
-
hosts.each { |host| host.refresh_global_status! }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
deleted_count
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|