foreman_rh_cloud 13.2.9 → 14.0.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/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
- data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
- data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
- data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
- data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
- data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +0 -9
- data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +2 -9
- data/app/models/concerns/rh_cloud_host.rb +3 -35
- data/app/models/insights_client_report_status.rb +1 -9
- data/app/models/inventory_sync/inventory_status.rb +4 -16
- data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +5 -12
- data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +2 -8
- data/lib/foreman_inventory_upload/generators/fact_helpers.rb +0 -8
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -1
- data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
- data/lib/foreman_rh_cloud/engine.rb +0 -1
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +8 -23
- data/lib/inventory_sync/async/inventory_full_sync.rb +3 -39
- data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/fr/foreman_rh_cloud.edit.po +1032 -0
- data/locale/fr/foreman_rh_cloud.po +65 -66
- data/locale/fr/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ja/foreman_rh_cloud.edit.po +1026 -0
- data/locale/ja/foreman_rh_cloud.po +70 -72
- data/locale/ja/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ka/foreman_rh_cloud.edit.po +1025 -0
- data/locale/ka/foreman_rh_cloud.po +10 -11
- data/locale/ka/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/ko/foreman_rh_cloud.edit.po +1029 -0
- data/locale/ko/foreman_rh_cloud.po +63 -64
- data/locale/ko/foreman_rh_cloud.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
- data/locale/zh_CN/foreman_rh_cloud.edit.po +1031 -0
- data/locale/zh_CN/foreman_rh_cloud.po +64 -65
- data/locale/zh_CN/foreman_rh_cloud.po.time_stamp +0 -0
- data/package.json +1 -1
- data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +1 -41
- data/test/jobs/insights_client_status_aging_test.rb +0 -40
- data/test/jobs/inventory_full_sync_test.rb +4 -219
- data/test/jobs/inventory_hosts_sync_test.rb +5 -7
- data/test/jobs/inventory_self_host_sync_test.rb +1 -1
- data/test/models/insights_client_report_status_test.rb +0 -109
- data/test/unit/archived_report_generator_test.rb +1 -2
- data/test/unit/fact_helpers_test.rb +0 -16
- data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +25 -80
- data/test/unit/rh_cloud_host_test.rb +0 -214
- data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +1 -1
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +1 -1
- data/test/unit/slice_generator_test.rb +2 -21
- data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +1 -6
- data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +6 -45
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +1 -3
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +2 -8
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +0 -1
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +17 -43
- data/webpack/ForemanInventoryUpload/ForemanInventoryHelpers.js +0 -7
- data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +14 -44
- metadata +16 -10
- data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +0 -23
- data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +0 -70
- data/test/models/inventory_sync/inventory_status_test.rb +0 -85
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +0 -82
- data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +0 -154
|
@@ -40,7 +40,6 @@ module ForemanRhCloud
|
|
|
40
40
|
::Host::Managed.include RhCloudHost
|
|
41
41
|
|
|
42
42
|
::Katello::Api::Rhsm::CandlepinDynflowProxyController.include InsightsCloud::PackageProfileUploadExtensions
|
|
43
|
-
::Katello::Api::Rhsm::CandlepinProxiesController.include InsightsCloud::CandlepinProxiesExtensions
|
|
44
43
|
::Katello::RegistrationManager.singleton_class.prepend ::ForemanRhCloud::RegistrationManagerExtensions
|
|
45
44
|
end
|
|
46
45
|
end
|
|
@@ -6,8 +6,6 @@ module InsightsCloud
|
|
|
6
6
|
class VmaasReposcanSync < ::Actions::EntryAction
|
|
7
7
|
include ::ForemanRhCloud::CertAuth
|
|
8
8
|
|
|
9
|
-
HTTP_TOO_MANY_REQUESTS = 429
|
|
10
|
-
|
|
11
9
|
# Subscribe to Katello repository sync hook action, if available
|
|
12
10
|
def self.subscribe
|
|
13
11
|
'Actions::Katello::Repository::SyncHook'.constantize
|
|
@@ -51,9 +49,15 @@ module InsightsCloud
|
|
|
51
49
|
|
|
52
50
|
response
|
|
53
51
|
rescue RestClient::ExceptionWithResponse => e
|
|
54
|
-
|
|
52
|
+
message = "VMaaS reposcan sync failed: #{e.response&.code} - #{e.response&.body}"
|
|
53
|
+
logger.error(message)
|
|
54
|
+
output[:message] = message
|
|
55
|
+
raise
|
|
55
56
|
rescue StandardError => e
|
|
56
|
-
|
|
57
|
+
message = "Error triggering VMaaS reposcan sync: #{e.message}, response: #{e.respond_to?(:response) ? e.response : nil}"
|
|
58
|
+
logger.error(message)
|
|
59
|
+
output[:message] = message
|
|
60
|
+
raise
|
|
57
61
|
end
|
|
58
62
|
|
|
59
63
|
def rescue_strategy_for_self
|
|
@@ -66,25 +70,6 @@ module InsightsCloud
|
|
|
66
70
|
|
|
67
71
|
private
|
|
68
72
|
|
|
69
|
-
def handle_rest_client_error(exception)
|
|
70
|
-
if exception.response&.code == HTTP_TOO_MANY_REQUESTS
|
|
71
|
-
message = "VMaaS reposcan sync skipped: another sync already in progress (#{HTTP_TOO_MANY_REQUESTS})"
|
|
72
|
-
logger.warn(message)
|
|
73
|
-
else
|
|
74
|
-
message = "VMaaS reposcan sync failed: #{exception.response&.code} - #{exception.response&.body}"
|
|
75
|
-
logger.error(message)
|
|
76
|
-
end
|
|
77
|
-
output[:message] = message
|
|
78
|
-
# Do NOT raise - let rescue_strategy_for_self Skip handle this
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def handle_standard_error(exception)
|
|
82
|
-
message = "Error triggering VMaaS reposcan sync: #{exception.message}"
|
|
83
|
-
logger.error(message)
|
|
84
|
-
output[:message] = message
|
|
85
|
-
# Do NOT raise - let rescue_strategy_for_self Skip handle this
|
|
86
|
-
end
|
|
87
|
-
|
|
88
73
|
def logger
|
|
89
74
|
action_logger
|
|
90
75
|
end
|
|
@@ -15,26 +15,16 @@ module InventorySync
|
|
|
15
15
|
|
|
16
16
|
def setup_statuses
|
|
17
17
|
@subscribed_hosts_ids = Set.new(affected_host_ids)
|
|
18
|
-
@omitted_ids = Set.new(user_omitted_host_ids)
|
|
19
|
-
|
|
20
|
-
# Remove user-omitted hosts from subscribed set. In normal operation, affected_host_ids
|
|
21
|
-
# already excludes user-omitted hosts via for_slice, but this handles edge cases like
|
|
22
|
-
# a host transitioning from uploaded to user-omitted between syncs.
|
|
23
|
-
@subscribed_hosts_ids.subtract(@omitted_ids)
|
|
24
18
|
|
|
25
19
|
InventorySync::InventoryStatus.transaction do
|
|
26
20
|
InventorySync::InventoryStatus.where(host_id: @subscribed_hosts_ids).delete_all
|
|
27
|
-
InventorySync::InventoryStatus.where(host_id: @omitted_ids).delete_all
|
|
28
21
|
yield
|
|
29
|
-
add_missing_hosts_statuses(@subscribed_hosts_ids)
|
|
30
|
-
add_user_omitted_host_statuses(@omitted_ids)
|
|
22
|
+
add_missing_hosts_statuses(@subscribed_hosts_ids)
|
|
31
23
|
host_statuses[:disconnect] += @subscribed_hosts_ids.size
|
|
32
|
-
host_statuses[:user_omitted] += @omitted_ids.size
|
|
33
24
|
end
|
|
34
25
|
|
|
35
|
-
logger.debug("Synced hosts
|
|
36
|
-
logger.debug("Disconnected hosts
|
|
37
|
-
logger.debug("User-omitted hosts count: #{host_statuses[:user_omitted]}")
|
|
26
|
+
logger.debug("Synced hosts amount: #{host_statuses[:sync]}")
|
|
27
|
+
logger.debug("Disconnected hosts amount: #{host_statuses[:disconnect]}")
|
|
38
28
|
output[:host_statuses] = host_statuses
|
|
39
29
|
end
|
|
40
30
|
|
|
@@ -54,7 +44,6 @@ module InventorySync
|
|
|
54
44
|
private
|
|
55
45
|
|
|
56
46
|
def update_hosts_status(status_hashes)
|
|
57
|
-
# create Inventory statuses
|
|
58
47
|
InventorySync::InventoryStatus.create(status_hashes)
|
|
59
48
|
updated_ids = status_hashes.map { |hash| hash[:host_id] }
|
|
60
49
|
@subscribed_hosts_ids.subtract(updated_ids)
|
|
@@ -72,23 +61,10 @@ module InventorySync
|
|
|
72
61
|
)
|
|
73
62
|
end
|
|
74
63
|
|
|
75
|
-
def add_user_omitted_host_statuses(host_ids)
|
|
76
|
-
InventorySync::InventoryStatus.create(
|
|
77
|
-
host_ids.map do |host_id|
|
|
78
|
-
{
|
|
79
|
-
host_id: host_id,
|
|
80
|
-
status: InventorySync::InventoryStatus::USER_OMITTED,
|
|
81
|
-
reported_at: DateTime.current,
|
|
82
|
-
}
|
|
83
|
-
end
|
|
84
|
-
)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
64
|
def host_statuses
|
|
88
65
|
@host_statuses ||= {
|
|
89
66
|
sync: 0,
|
|
90
67
|
disconnect: 0,
|
|
91
|
-
user_omitted: 0,
|
|
92
68
|
}
|
|
93
69
|
end
|
|
94
70
|
|
|
@@ -97,18 +73,6 @@ module InventorySync
|
|
|
97
73
|
Host.unscoped.where(organization: organizations)
|
|
98
74
|
).pluck(:id)
|
|
99
75
|
end
|
|
100
|
-
|
|
101
|
-
def user_omitted_host_ids
|
|
102
|
-
param_name = InsightsCloud.enable_client_param_inventory
|
|
103
|
-
|
|
104
|
-
# Use search_for to respect parameter inheritance (global, org, hostgroup, host)
|
|
105
|
-
# This matches the same logic used by for_slice, ensuring consistency
|
|
106
|
-
Host.unscoped
|
|
107
|
-
.where(organization: organizations)
|
|
108
|
-
.joins(:subscription_facet)
|
|
109
|
-
.search_for("params.#{param_name} = f")
|
|
110
|
-
.pluck(:id)
|
|
111
|
-
end
|
|
112
76
|
end
|
|
113
77
|
end
|
|
114
78
|
end
|
|
Binary file
|