foreman_rh_cloud 11.4.4 → 12.0.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +2 -2
  4. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +22 -26
  5. data/app/services/foreman_rh_cloud/cloud_request.rb +2 -12
  6. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +3 -17
  7. data/app/services/foreman_rh_cloud/rules_ingester.rb +1 -12
  8. data/config/routes.rb +0 -4
  9. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +3 -3
  10. data/lib/foreman_inventory_upload/async/upload_report_job.rb +4 -4
  11. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +13 -65
  12. data/lib/foreman_inventory_upload/generators/queries.rb +3 -5
  13. data/lib/foreman_inventory_upload/generators/slice.rb +1 -0
  14. data/lib/foreman_rh_cloud/engine.rb +0 -11
  15. data/lib/foreman_rh_cloud/version.rb +1 -1
  16. data/lib/foreman_rh_cloud.rb +0 -2
  17. data/lib/tasks/hybrid_cloud.rake +36 -94
  18. data/package.json +5 -5
  19. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +2 -14
  20. data/test/controllers/inventory_upload/api/inventory_controller_test.rb +1 -1
  21. data/test/jobs/upload_report_job_test.rb +1 -1
  22. data/test/unit/fact_helpers_test.rb +2 -267
  23. data/test/unit/slice_generator_test.rb +10 -69
  24. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +1 -7
  25. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItemStatus/__tests__/__snapshots__/ListItemStatus.test.js.snap +1 -5
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +3 -3
  27. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -1
  28. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/inventoryFilter.scss +1 -1
  29. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +5 -5
  30. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageTitle.js +5 -4
  31. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/CloudPingModal/index.js +18 -3
  32. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButton.js +0 -1
  33. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButton.test.js.snap +0 -1
  34. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/__snapshots__/InventoryAutoUpload.test.js.snap +2 -10
  35. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +5 -1
  36. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableConstants.js +1 -1
  37. data/webpack/InsightsCloudSync/Components/InsightsTable/Pagination.js +7 -7
  38. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +1 -1
  39. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +5 -1
  40. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +8 -1
  41. data/webpack/InsightsCloudSync/Components/ToolbarDropdown.js +8 -2
  42. data/webpack/InsightsCloudSync/InsightsCloudSync.scss +1 -1
  43. data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +11 -2
  44. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +5 -4
  45. data/webpack/common/DropdownToggle.js +2 -2
  46. data/webpack/common/Switcher/HelpLabel.js +1 -1
  47. data/webpack/common/Switcher/SwitcherPF4.scss +1 -1
  48. data/webpack/common/Switcher/__tests__/__snapshots__/HelpLabel.test.js.snap +2 -6
  49. data/webpack/common/table/EmptyState.js +25 -18
  50. metadata +3 -35
@@ -98,25 +98,13 @@ module InsightsCloud::Api
98
98
  assert_equal net_http_resp[:content_type], @response.headers['Content-Type']
99
99
  end
100
100
 
101
- test "should handle 304 cloud" do
102
- net_http_resp = Net::HTTPResponse.new(1.0, 304, "Not Modified")
103
- res = RestClient::Response.create(@body, net_http_resp, @http_req)
104
-
105
- ::ForemanRhCloud::CloudRequestForwarder.any_instance.stubs(:execute_cloud_request).raises(RestClient::NotModified.new(res))
106
-
107
- get :forward_request, params: { "path" => "platform/module-update-router/v1/channel" }
108
- assert_equal 304, @response.status
109
- assert_equal 'Cloud request not modified', JSON.parse(@response.body)['message']
110
- end
111
-
112
101
  test "should handle failed authentication to cloud" do
113
102
  net_http_resp = Net::HTTPResponse.new(1.0, 401, "Unauthorized")
114
103
  res = RestClient::Response.create(@body, net_http_resp, @http_req)
115
-
116
- ::ForemanRhCloud::CloudRequestForwarder.any_instance.stubs(:execute_cloud_request).raises(RestClient::Unauthorized.new(res))
104
+ ::ForemanRhCloud::CloudRequestForwarder.any_instance.stubs(:forward_request).returns(res)
117
105
 
118
106
  get :forward_request, params: { "path" => "platform/module-update-router/v1/channel" }
119
- assert_equal 401, @response.status
107
+ assert_equal 502, @response.status
120
108
  assert_equal 'Authentication to the Insights Service failed.', JSON.parse(@response.body)['message']
121
109
  end
122
110
 
@@ -14,7 +14,7 @@ module InventoryUpload::Api
14
14
  .expects(:start_report_generation)
15
15
  .with(@test_org.id.to_s, @disconnected)
16
16
 
17
- post :generate_report, params: { organization_id: @test_org.id, disconnected: @disconnected }
17
+ post :generate_report, params: { organization_id: @test_org.id, no_upload: @disconnected }
18
18
 
19
19
  assert_response :success
20
20
  end
@@ -18,7 +18,7 @@ class UploadReportJobTest < ActiveSupport::TestCase
18
18
 
19
19
  label = ForemanInventoryUpload::Async::UploadReportJob.output_label(organization.id)
20
20
  progress_output = ForemanInventoryUpload::Async::ProgressOutput.get(label)
21
- assert_match(/Upload was stopped/, progress_output.full_output)
21
+ assert_match(/Upload canceled/, progress_output.full_output)
22
22
  assert_match(/exit 1/, progress_output.status)
23
23
  end
24
24
 
@@ -1,5 +1,4 @@
1
1
  require 'test_plugin_helper'
2
- require 'digest'
3
2
 
4
3
  class FactHelpersTest < ActiveSupport::TestCase
5
4
  class FactsHelpersTestStub
@@ -30,7 +29,7 @@ class FactHelpersTest < ActiveSupport::TestCase
30
29
 
31
30
  test 'obfuscates ips with insights-client data' do
32
31
  host = mock('host')
33
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_ipv4').returns(
32
+ @instance.expects(:fact_value).with(host, 'insights_client::ips').returns(
34
33
  '[{"obfuscated": "10.230.230.1", "original": "224.0.0.1"}, {"obfuscated": "10.230.230.255", "original": "224.0.0.251"}]'
35
34
  )
36
35
 
@@ -42,275 +41,11 @@ class FactHelpersTest < ActiveSupport::TestCase
42
41
 
43
42
  test 'obfuscates ips without insights-client data' do
44
43
  host = mock('host')
45
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_ipv4').returns(nil)
44
+ @instance.expects(:fact_value).with(host, 'insights_client::ips').returns(nil)
46
45
 
47
46
  actual = @instance.obfuscated_ips(host)
48
47
 
49
48
  assert_equal '10.230.230.1', actual['224.0.0.1']
50
49
  assert_equal '10.230.230.2', actual['224.0.0.2']
51
50
  end
52
-
53
- describe 'obfuscate_hostname?' do
54
- test 'returns true when global setting is enabled' do
55
- Setting.expects(:[]).with(:obfuscate_inventory_hostnames).returns(true)
56
- host = mock('host')
57
-
58
- result = @instance.obfuscate_hostname?(host)
59
-
60
- assert result
61
- end
62
-
63
- test 'returns false when global setting is disabled and no host-specific setting' do
64
- Setting.expects(:[]).with(:obfuscate_inventory_hostnames).returns(false)
65
- host = mock('host')
66
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_hostname_enabled').returns(nil)
67
-
68
- result = @instance.obfuscate_hostname?(host)
69
-
70
- refute result
71
- end
72
-
73
- test 'returns true when host-specific setting is enabled' do
74
- Setting.expects(:[]).with(:obfuscate_inventory_hostnames).returns(false)
75
- host = mock('host')
76
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_hostname_enabled').returns('true')
77
-
78
- result = @instance.obfuscate_hostname?(host)
79
-
80
- assert result
81
- end
82
-
83
- test 'returns false when host-specific setting is disabled' do
84
- Setting.expects(:[]).with(:obfuscate_inventory_hostnames).returns(false)
85
- host = mock('host')
86
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_hostname_enabled').returns('false')
87
-
88
- result = @instance.obfuscate_hostname?(host)
89
-
90
- refute result
91
- end
92
- end
93
-
94
- describe 'fqdn' do
95
- test 'returns original fqdn when obfuscation is disabled' do
96
- host = mock('host')
97
- host.expects(:fqdn).returns('test.example.com')
98
- @instance.expects(:obfuscate_hostname?).with(host).returns(false)
99
-
100
- result = @instance.fqdn(host)
101
-
102
- assert_equal 'test.example.com', result
103
- end
104
-
105
- test 'returns obfuscated hostname from insights_client fact when available' do
106
- host = mock('host')
107
- host.expects(:fqdn).returns('test.example.com').once
108
- @instance.expects(:obfuscate_hostname?).with(host).returns(true)
109
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_hostname').returns(
110
- '[{"original": "test.example.com", "obfuscated": "abc123.example.com"}]'
111
- )
112
-
113
- result = @instance.fqdn(host)
114
-
115
- assert_equal 'abc123.example.com', result
116
- end
117
-
118
- test 'returns dynamically obfuscated hostname when insights_client fact is not available' do
119
- host = mock('host')
120
- host.stubs(:fqdn).returns('test.example.com')
121
- @instance.expects(:obfuscate_hostname?).with(host).returns(true)
122
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_hostname').returns(nil)
123
-
124
- result = @instance.fqdn(host)
125
-
126
- expected = "#{Digest::SHA1.hexdigest('test.example.com')}.example.com"
127
- assert_equal expected, result
128
- end
129
-
130
- test 'returns dynamically obfuscated hostname when insights_client fact does not contain matching host' do
131
- host = mock('host')
132
- host.expects(:fqdn).returns('test.example.com').twice
133
- @instance.expects(:obfuscate_hostname?).with(host).returns(true)
134
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_hostname').returns(
135
- '[{"original": "other.example.com", "obfuscated": "abc123.example.com"}]'
136
- )
137
- @instance.expects(:obfuscate_fqdn).with('test.example.com').returns('dynamically_obfuscated.example.com')
138
-
139
- result = @instance.fqdn(host)
140
-
141
- assert_equal 'dynamically_obfuscated.example.com', result
142
- end
143
-
144
- test 'handles invalid JSON in insights_client fact gracefully' do
145
- host = mock('host')
146
- host.stubs(:fqdn).returns('test.example.com')
147
- @instance.expects(:obfuscate_hostname?).with(host).returns(true)
148
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_hostname').returns('invalid json')
149
-
150
- result = @instance.fqdn(host)
151
-
152
- expected = "#{Digest::SHA1.hexdigest('test.example.com')}.example.com"
153
- assert_equal expected, result
154
- end
155
-
156
- test 'handles empty insights_client fact' do
157
- host = mock('host')
158
- host.stubs(:fqdn).returns('test.example.com')
159
- @instance.expects(:obfuscate_hostname?).with(host).returns(true)
160
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_hostname').returns('[]')
161
-
162
- result = @instance.fqdn(host)
163
-
164
- expected = "#{Digest::SHA1.hexdigest('test.example.com')}.example.com"
165
- assert_equal expected, result
166
- end
167
- end
168
-
169
- describe 'obfuscate_ips?' do
170
- test 'returns true when global setting is enabled' do
171
- Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(true)
172
- host = mock('host')
173
-
174
- result = @instance.obfuscate_ips?(host)
175
-
176
- assert result
177
- end
178
-
179
- test 'returns false when global setting is disabled and no host-specific settings' do
180
- Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(false)
181
- host = mock('host')
182
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv4_enabled').returns(nil)
183
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv6_enabled').returns(nil)
184
-
185
- result = @instance.obfuscate_ips?(host)
186
-
187
- refute result
188
- end
189
-
190
- test 'returns true when host-specific IPv4 setting is enabled' do
191
- Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(false)
192
- host = mock('host')
193
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv4_enabled').returns('true')
194
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv6_enabled').returns(nil)
195
-
196
- result = @instance.obfuscate_ips?(host)
197
-
198
- assert result
199
- end
200
-
201
- test 'returns true when host-specific IPv6 setting is enabled' do
202
- Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(false)
203
- host = mock('host')
204
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv4_enabled').returns(nil)
205
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv6_enabled').returns('true')
206
-
207
- result = @instance.obfuscate_ips?(host)
208
-
209
- assert result
210
- end
211
-
212
- test 'returns true when both IPv4 and IPv6 settings are enabled' do
213
- Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(false)
214
- host = mock('host')
215
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv4_enabled').returns('true')
216
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv6_enabled').returns('true')
217
-
218
- result = @instance.obfuscate_ips?(host)
219
-
220
- assert result
221
- end
222
-
223
- test 'returns false when both IPv4 and IPv6 settings are disabled' do
224
- Setting.expects(:[]).with(:obfuscate_inventory_ips).returns(false)
225
- host = mock('host')
226
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv4_enabled').returns('false')
227
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscate_ipv6_enabled').returns('false')
228
-
229
- result = @instance.obfuscate_ips?(host)
230
-
231
- refute result
232
- end
233
- end
234
-
235
- describe 'obfuscate_ip' do
236
- test 'generates first IP when no existing obfuscated IPs' do
237
- ips_dict = {}
238
-
239
- result = @instance.obfuscate_ip('192.168.1.1', ips_dict)
240
-
241
- assert_equal '10.230.230.1', result
242
- end
243
-
244
- test 'generates next sequential IP when existing obfuscated IPs present' do
245
- ips_dict = { '192.168.1.1' => '10.230.230.5', '192.168.1.2' => '10.230.230.10' }
246
-
247
- result = @instance.obfuscate_ip('192.168.1.3', ips_dict)
248
-
249
- assert_equal '10.230.230.11', result
250
- end
251
-
252
- test 'handles mixed IP ranges correctly' do
253
- ips_dict = { '192.168.1.1' => '10.230.230.255', '192.168.1.2' => '10.230.230.1' }
254
-
255
- result = @instance.obfuscate_ip('192.168.1.3', ips_dict)
256
-
257
- assert_equal '10.230.231.0', result
258
- end
259
-
260
- test 'generates valid IP addresses' do
261
- ips_dict = {}
262
-
263
- result = @instance.obfuscate_ip('any.ip.address', ips_dict)
264
-
265
- assert_match(/\A\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/, result)
266
- assert_nothing_raised { IPAddr.new(result) }
267
- end
268
- end
269
-
270
- describe 'obfuscated_ips' do
271
- test 'handles invalid JSON in insights_client fact gracefully' do
272
- host = mock('host')
273
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_ipv4').returns('invalid json')
274
-
275
- result = @instance.obfuscated_ips(host)
276
-
277
- assert_equal '10.230.230.1', result['192.168.1.1']
278
- end
279
-
280
- test 'handles empty insights_client fact' do
281
- host = mock('host')
282
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_ipv4').returns('[]')
283
-
284
- result = @instance.obfuscated_ips(host)
285
-
286
- assert_equal '10.230.230.1', result['192.168.1.1']
287
- end
288
-
289
- test 'preserves existing obfuscated IPs and generates new ones' do
290
- host = mock('host')
291
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_ipv4').returns(
292
- '[{"original": "192.168.1.1", "obfuscated": "10.230.230.5"}]'
293
- )
294
-
295
- result = @instance.obfuscated_ips(host)
296
-
297
- assert_equal '10.230.230.5', result['192.168.1.1']
298
- assert_equal '10.230.230.6', result['192.168.1.2']
299
- end
300
-
301
- test 'default_proc generates unique sequential IPs' do
302
- host = mock('host')
303
- @instance.expects(:fact_value).with(host, 'insights_client::obfuscated_ipv4').returns(nil)
304
-
305
- result = @instance.obfuscated_ips(host)
306
-
307
- ip1 = result['192.168.1.1']
308
- ip2 = result['192.168.1.2']
309
- ip3 = result['192.168.1.3']
310
-
311
- assert_equal '10.230.230.1', ip1
312
- assert_equal '10.230.230.2', ip2
313
- assert_equal '10.230.230.3', ip3
314
- end
315
- end
316
51
  end
@@ -56,10 +56,9 @@ class SliceGeneratorTest < ActiveSupport::TestCase
56
56
  'dmi::system::product_name',
57
57
  'dmi::chassis::asset_tag',
58
58
  'insights_client::obfuscate_hostname_enabled',
59
- 'insights_client::obfuscated_hostname',
60
- 'insights_client::obfuscate_ipv4_enabled',
61
- 'insights_client::obfuscated_ipv4',
62
59
  'insights_client::hostname',
60
+ 'insights_client::obfuscate_ip_enabled',
61
+ 'insights_client::ips',
63
62
  'insights_id',
64
63
  ]
65
64
  end
@@ -211,38 +210,14 @@ class SliceGeneratorTest < ActiveSupport::TestCase
211
210
  assert_equal 1, generator.hosts_count
212
211
  end
213
212
 
214
- test 'does not obfuscate fqdn when insights_client obfuscate_hostname_enabled fact is missing and obfuscate_inventory_hostnames setting is false' do
215
- # Create a host and obfuscated_hostname fact, but do NOT create the obfuscate_hostname_enabled fact
216
- obfuscated_hostname_data = [
217
- { 'original' => @host.fqdn, 'obfuscated' => '0dd449d0a027.example.com' },
218
- ]
219
- obfuscated_hostname_value = JSON.generate(obfuscated_hostname_data)
220
- FactoryBot.create(:fact_value,
221
- fact_name: fact_names['insights_client::obfuscated_hostname'],
222
- value: obfuscated_hostname_value,
223
- host: @host)
224
- # Do NOT create the 'insights_client::obfuscate_hostname_enabled' fact
225
-
226
- batch = Host.where(id: @host.id).in_batches.first
227
- generator = create_generator(batch)
228
-
229
- json_str = generator.render
230
- actual = JSON.parse(json_str.join("\n"))
231
-
232
- assert_not_nil(actual_host = actual['hosts'].first)
233
- assert_equal @host.fqdn, actual_host['fqdn'], "FQDN should not be obfuscated when obfuscate_hostname_enabled is missing and setting is false"
234
- assert_not_nil(actual_facts = actual_host['facts'].first['facts'])
235
- assert_not_equal true, actual_facts['is_hostname_obfuscated']
236
- end
237
-
238
- test 'generates obfuscated ip_address fields when insights-client facts are present' do
213
+ test 'generates obfuscated ip_address fields with inisghts-client' do
239
214
  nic = FactoryBot.build(:nic_managed)
240
215
  @host.interfaces << nic
241
216
 
242
- FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::obfuscate_ipv4_enabled'], value: 'true', host: @host)
217
+ FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::obfuscate_ip_enabled'], value: 'true', host: @host)
243
218
  FactoryBot.create(
244
219
  :fact_value,
245
- fact_name: fact_names['insights_client::obfuscated_ipv4'],
220
+ fact_name: fact_names['insights_client::ips'],
246
221
  value: "[{\"obfuscated\": \"10.230.230.100\", \"original\": \"#{nic.ip}\"}]",
247
222
  host: @host
248
223
  )
@@ -265,17 +240,9 @@ class SliceGeneratorTest < ActiveSupport::TestCase
265
240
  assert_equal 1, generator.hosts_count
266
241
  end
267
242
 
268
- test 'obfuscates fqdn when insights-client facts are present' do
269
- obfuscated_hostname_data = [
270
- { 'original' => @host.fqdn, 'obfuscated' => '0dd449d0a027.example.com' },
271
- { 'original' => 'satellite.theforeman.org', 'obfuscated' => 'host2.example.com' },
272
- ]
273
- obfuscated_hostname_value = JSON.generate(obfuscated_hostname_data)
274
- FactoryBot.create(:fact_value,
275
- fact_name: fact_names['insights_client::obfuscated_hostname'],
276
- value: obfuscated_hostname_value,
277
- host: @host)
243
+ test 'obfuscates fqdn when instructed by insights-client' do
278
244
  FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::obfuscate_hostname_enabled'], value: 'true', host: @host)
245
+ FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::hostname'], value: 'obfuscated_name', host: @host)
279
246
 
280
247
  batch = Host.where(id: @host.id).in_batches.first
281
248
  generator = create_generator(batch)
@@ -285,7 +252,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
285
252
 
286
253
  assert_equal '00000000-0000-0000-0000-000000000000', actual['report_slice_id']
287
254
  assert_not_nil(actual_host = actual['hosts'].first)
288
- assert_equal obfuscated_hostname_data.first['obfuscated'], actual_host['fqdn']
255
+ assert_equal 'obfuscated_name', actual_host['fqdn']
289
256
  assert_equal '1234', actual_host['account']
290
257
  assert_not_nil(actual_facts = actual_host['facts'].first['facts'])
291
258
  assert_equal true, actual_facts['is_hostname_obfuscated']
@@ -312,35 +279,9 @@ class SliceGeneratorTest < ActiveSupport::TestCase
312
279
  assert_equal 1, generator.hosts_count
313
280
  end
314
281
 
315
- test 'obfuscates host fqdn with insights-client when setting set' do
316
- Setting[:obfuscate_inventory_hostnames] = true
317
- FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::hostname'], value: @host.fqdn, host: @host)
318
-
319
- batch = Host.where(id: @host.id).in_batches.first
320
- generator = create_generator(batch)
321
-
322
- json_str = generator.render
323
- actual = JSON.parse(json_str.join("\n"))
324
-
325
- obfuscated_fqdn = Digest::SHA1.hexdigest(@host.fqdn) + '.example.com'
326
-
327
- assert_equal '00000000-0000-0000-0000-000000000000', actual['report_slice_id']
328
- assert_not_nil(actual_host = actual['hosts'].first)
329
- assert_equal obfuscated_fqdn, actual_host['fqdn']
330
- assert_equal '1234', actual_host['account']
331
- assert_not_nil(actual_facts = actual_host['facts'].first['facts'])
332
- assert_equal true, actual_facts['is_hostname_obfuscated']
333
- assert_equal 1, generator.hosts_count
334
- end
335
-
336
- test 'does not obfuscate fqdn when host fact from insights-client has a value of false' do
337
- obfuscated_hostname_data = [
338
- { 'original' => @host.fqdn, 'obfuscated' => '0dd449d0a027.example.com' },
339
- { 'original' => 'satellite.theforeman.org', 'obfuscated' => 'host2.example.com' },
340
- ]
341
- obfuscated_hostname_value = JSON.generate(obfuscated_hostname_data)
282
+ test 'does not obfuscate fqdn when insights-client sets to false' do
342
283
  FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::obfuscate_hostname_enabled'], value: 'false', host: @host)
343
- FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::obfuscated_hostname'], value: obfuscated_hostname_value, host: @host)
284
+ FactoryBot.create(:fact_value, fact_name: fact_names['insights_client::hostname'], value: 'obfuscated_name', host: @host)
344
285
 
345
286
  batch = Host.where(id: @host.id).in_batches.first
346
287
  generator = create_generator(batch)
@@ -10,13 +10,7 @@ exports[`ListItem rendering render with Props 1`] = `
10
10
  <Label
11
11
  className="account-icon"
12
12
  color="blue"
13
- icon={
14
- <UserIcon
15
- color="currentColor"
16
- noVerticalAlign={false}
17
- size="sm"
18
- />
19
- }
13
+ icon={<UserIcon />}
20
14
  variant="outline"
21
15
  />
22
16
  test
@@ -12,11 +12,7 @@ exports[`ListItemStatus rendering render with Props 1`] = `
12
12
  <p>
13
13
  Generating
14
14
  </p>
15
- <CheckIcon
16
- color="currentColor"
17
- noVerticalAlign={false}
18
- size="sm"
19
- />
15
+ <CheckIcon />
20
16
  </GridItem>
21
17
  <GridItem
22
18
  className="item"
@@ -8,11 +8,11 @@
8
8
  }
9
9
 
10
10
  .account-list {
11
- .pf-c-accordion__toggle {
11
+ .pf-v5-c-accordion__toggle {
12
12
  margin-top: 10px;
13
13
  }
14
14
 
15
- .pf-c-accordion__toggle-text {
15
+ .pf-v5-c-accordion__toggle-text {
16
16
  font-size: 16px;
17
17
  display: flex;
18
18
  justify-content: space-between;
@@ -21,7 +21,7 @@
21
21
  .account-icon {
22
22
  margin-right: 5px;
23
23
 
24
- .pf-c-label__icon {
24
+ .pf-v5-c-label__icon {
25
25
  margin: 0;
26
26
  }
27
27
  }
@@ -29,7 +29,7 @@ const InventoryFilter = ({
29
29
  value={filterTerm}
30
30
  type="text"
31
31
  placeholder={__('Filter..')}
32
- onChange={handleFilterChange}
32
+ onChange={(e, v) => handleFilterChange(v)}
33
33
  />
34
34
  <ClearButton onClear={handleFilterClear} />
35
35
  </FormGroup>
@@ -1,5 +1,5 @@
1
1
  #inventory_filter_form {
2
- .pf-c-form__group-control {
2
+ .pf-v5-c-form__group-control {
3
3
  display: -ms-flexbox;
4
4
  display: -webkit-flex;
5
5
  display: flex;
@@ -12,18 +12,18 @@
12
12
  font-size: 16px;
13
13
  }
14
14
 
15
- .pf-c-dropdown__toggle {
15
+ .pf-v5-c-dropdown__toggle {
16
16
  margin-right: -20px;
17
17
  }
18
18
 
19
19
  .settings-alert {
20
20
  margin-bottom: 30px;
21
- .pf-c-alert {
21
+ .pf-v5-c-alert {
22
22
  margin-bottom: 5px;
23
23
 
24
- .pf-c-alert__title {
25
- font-size: var(--pf-global--FontSize--md);
26
- line-height: var(--pf-global--LineHeight--md);
24
+ .pf-v5-c-alert__title {
25
+ font-size: var(--pf-v5-global--FontSize--md);
26
+ line-height: var(--pf-v5-global--LineHeight--md);
27
27
  }
28
28
  }
29
29
  }
@@ -1,12 +1,11 @@
1
1
  import React, { useState } from 'react';
2
+ import { Grid, GridItem } from '@patternfly/react-core';
2
3
  import {
3
4
  Dropdown,
4
5
  DropdownItem,
5
6
  KebabToggle,
6
7
  DropdownPosition,
7
- Grid,
8
- GridItem,
9
- } from '@patternfly/react-core';
8
+ } from '@patternfly/react-core/deprecated';
10
9
  import Head from 'foremanReact/components/Head';
11
10
  import {
12
11
  INVENTORY_PAGE_TITLE,
@@ -58,7 +57,9 @@ const PageTitle = () => {
58
57
  className="title-dropdown"
59
58
  onSelect={() => setIsDropdownOpen(false)}
60
59
  toggle={
61
- <KebabToggle onToggle={isOpen => setIsDropdownOpen(isOpen)} />
60
+ <KebabToggle
61
+ onToggle={(_event, isOpen) => setIsDropdownOpen(isOpen)}
62
+ />
62
63
  }
63
64
  isOpen={isDropdownOpen}
64
65
  isPlain
@@ -2,7 +2,11 @@
2
2
  import React, { useCallback, useEffect, useState } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import { useDispatch, useSelector } from 'react-redux';
5
- import { Table, TableBody, TableHeader } from '@patternfly/react-table';
5
+ import {
6
+ Table,
7
+ TableBody,
8
+ TableHeader,
9
+ } from '@patternfly/react-table/deprecated';
6
10
  import {
7
11
  Card,
8
12
  CardTitle,
@@ -11,6 +15,7 @@ import {
11
15
  ModalVariant,
12
16
  Spinner,
13
17
  Text,
18
+ Icon,
14
19
  } from '@patternfly/react-core';
15
20
  import {
16
21
  CheckCircleIcon,
@@ -108,8 +113,18 @@ const CloudPingModal = ({ title, isOpen, toggle }) => {
108
113
 
109
114
  const StatusIcon = ({ isPending, authStatus }) => {
110
115
  if (isPending) return <Spinner size="sm" />;
111
- if (authStatus.success) return <CheckCircleIcon color="green" />;
112
- if (authStatus.error) return <ExclamationCircleIcon color="red" />;
116
+ if (authStatus.success)
117
+ return (
118
+ <Icon color="green">
119
+ <CheckCircleIcon />
120
+ </Icon>
121
+ );
122
+ if (authStatus.error)
123
+ return (
124
+ <Icon color="red">
125
+ <ExclamationCircleIcon />
126
+ </Icon>
127
+ );
113
128
  return <Spinner size="sm" />;
114
129
  };
115
130
 
@@ -22,7 +22,6 @@ class SyncButton extends React.Component {
22
22
  <Button
23
23
  className="sync_button"
24
24
  onClick={handleClick}
25
- size="lg"
26
25
  isDisabled={status === STATUS.PENDING}
27
26
  variant="secondary"
28
27
  >
@@ -6,7 +6,6 @@ exports[`SyncButton rendering render with Props 1`] = `
6
6
  className="sync_button"
7
7
  isDisabled={false}
8
8
  onClick={[Function]}
9
- size="lg"
10
9
  variant="secondary"
11
10
  >
12
11
  Sync all inventory status
@@ -56,11 +56,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
56
56
  >
57
57
  Show Advanced Settings
58
58
 
59
- <CaretRightIcon
60
- color="currentColor"
61
- noVerticalAlign={false}
62
- size="sm"
63
- />
59
+ <CaretRightIcon />
64
60
  </Button>
65
61
  </Popover>
66
62
  </Col>
@@ -78,11 +74,7 @@ exports[`InventoryAutoUpload rendering render with props 1`] = `
78
74
  <Text
79
75
  component="p"
80
76
  >
81
- <InfoAltIcon
82
- color="currentColor"
83
- noVerticalAlign={false}
84
- size="sm"
85
- />
77
+ <InfoAltIcon />
86
78
 
87
79
  More details can be found in
88
80