foreman_rh_cloud 14.0.2 → 14.1.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +61 -61
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +68 -68
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +9 -9
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +60 -60
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +60 -60
  7. data/app/controllers/concerns/insights_cloud/candlepin_proxies_extensions.rb +23 -0
  8. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +9 -0
  9. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +1 -1
  10. data/app/controllers/foreman_inventory_upload/api/tasks_controller.rb +2 -2
  11. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +9 -2
  12. data/app/models/concerns/rh_cloud_host.rb +35 -3
  13. data/app/models/insights_client_report_status.rb +9 -1
  14. data/app/models/inventory_sync/inventory_status.rb +16 -4
  15. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +12 -5
  16. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +8 -2
  17. data/lib/foreman_rh_cloud/engine.rb +1 -0
  18. data/lib/foreman_rh_cloud/version.rb +1 -1
  19. data/lib/insights_cloud/async/vmaas_reposcan_sync.rb +23 -8
  20. data/lib/inventory_sync/async/inventory_full_sync.rb +39 -3
  21. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  22. data/locale/fr/foreman_rh_cloud.po +66 -65
  23. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  24. data/locale/ja/foreman_rh_cloud.po +72 -70
  25. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  26. data/locale/ka/foreman_rh_cloud.po +11 -10
  27. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  28. data/locale/ko/foreman_rh_cloud.po +64 -63
  29. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  30. data/locale/zh_CN/foreman_rh_cloud.po +65 -64
  31. data/package.json +1 -1
  32. data/test/controllers/insights_cloud/api/machine_telemetries_controller_test.rb +40 -0
  33. data/test/controllers/insights_cloud/candlepin_proxies_extensions_test.rb +70 -0
  34. data/test/jobs/insights_client_status_aging_test.rb +40 -0
  35. data/test/jobs/inventory_full_sync_test.rb +212 -0
  36. data/test/models/insights_client_report_status_test.rb +109 -0
  37. data/test/models/inventory_sync/inventory_status_test.rb +85 -0
  38. data/test/unit/lib/insights_cloud/async/vmaas_reposcan_sync_test.rb +80 -25
  39. data/test/unit/rh_cloud_host_test.rb +214 -0
  40. data/webpack/CVEsHostDetailsTab/CVEsHostDetailsTab.js +6 -1
  41. data/webpack/CVEsHostDetailsTab/__tests__/CVEsHostDetailsTab.test.js +45 -6
  42. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +8 -2
  43. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +1 -0
  44. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +1 -0
  45. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Toast.js +43 -17
  46. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +82 -0
  47. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +7 -4
  48. data/webpack/InsightsCloudSync/Components/InsightsTable/table.scss +9 -0
  49. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +44 -14
  50. data/webpack/InsightsHostDetailsTab/__tests__/NewHostDetailsTab.test.js +154 -0
  51. metadata +9 -2
@@ -4,19 +4,20 @@
4
4
  # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
6
  # Translators:
7
- # Bryan Kearney <bryan.kearney@gmail.com>, 2023
8
7
  # tim123, 2023
9
8
  # 0868a4d1af5275b3f70b0a6dac4c99a4, 2023
10
- # Amit Upadhye <aupadhye@redhat.com>, 2023
11
- # Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2025
12
- # Ondřej Gajdušek, 2025
9
+ # Amit Upadhye <aupadhye@redhat.com>, 2026
10
+ # Ewoud Kohl van Wijngaarden <ewoud+transifex@kohlvanwijngaarden.nl>, 2026
11
+ # Bryan Kearney <bryan.kearney@gmail.com>, 2026
12
+ # Ondřej Gajdušek, 2026
13
13
  #
14
+ #, fuzzy
14
15
  msgid ""
15
16
  msgstr ""
16
- "Project-Id-Version: foreman_rh_cloud 13.2.0\n"
17
+ "Project-Id-Version: foreman_rh_cloud 14.0.2\n"
17
18
  "Report-Msgid-Bugs-To: \n"
18
19
  "PO-Revision-Date: 2023-01-20 13:26+0000\n"
19
- "Last-Translator: Ondřej Gajdušek, 2025\n"
20
+ "Last-Translator: Ondřej Gajdušek, 2026\n"
20
21
  "Language-Team: Chinese (China) (https://app.transifex.com/foreman/teams/114/zh"
21
22
  "_CN/)\n"
22
23
  "MIME-Version: 1.0\n"
@@ -32,7 +33,7 @@ msgid "%s organizations"
32
33
  msgstr "%s 机构"
33
34
 
34
35
  msgid "A specific organization must be selected from the organization context."
35
- msgstr ""
36
+ msgstr "必须从机构上下文中选择一个特定的机构。"
36
37
 
37
38
  msgid "About subscription watch"
38
39
  msgstr "订阅查看"
@@ -47,7 +48,7 @@ msgid "All recommendations are now selected."
47
48
  msgstr "现在选择了所有建议。"
48
49
 
49
50
  msgid "Analysis disabled"
50
- msgstr ""
51
+ msgstr "禁用分析"
51
52
 
52
53
  msgid "Analytics data collection"
53
54
  msgstr "数据收集分析"
@@ -59,7 +60,7 @@ msgid "Apply Insights recommendations"
59
60
  msgstr "应用 Insights 建议"
60
61
 
61
62
  msgid "Attempted to destroy HBI host %s, but host does not exist in HBI"
62
- msgstr ""
63
+ msgstr "尝试销毁 HBI 主机 %s,但主机在 HBI 中不存在"
63
64
 
64
65
  msgid "Automatic inventory upload"
65
66
  msgstr "自动清单上传"
@@ -101,7 +102,7 @@ msgid "Completed"
101
102
  msgstr "完成"
102
103
 
103
104
  msgid "Completed with warnings"
104
- msgstr ""
105
+ msgstr "完成,带有警告"
105
106
 
106
107
  msgid "Configure"
107
108
  msgstr "配置"
@@ -122,13 +123,13 @@ msgid "Current page"
122
123
  msgstr "当前页"
123
124
 
124
125
  msgid "Details"
125
- msgstr ""
126
+ msgstr "详情"
126
127
 
127
128
  msgid "Disable"
128
- msgstr ""
129
+ msgstr "禁用"
129
130
 
130
131
  msgid "Disable vulnerability analysis"
131
- msgstr ""
132
+ msgstr "禁用漏洞分析"
132
133
 
133
134
  msgid "Disconnected hosts: "
134
135
  msgstr "断开连接的主机:"
@@ -146,28 +147,28 @@ msgid "Download latest report"
146
147
  msgstr "下载最新的报告"
147
148
 
148
149
  msgid "Download report"
149
- msgstr ""
150
+ msgstr "下载报告"
150
151
 
151
152
  msgid "Duration"
152
- msgstr ""
153
+ msgstr "持续时间"
153
154
 
154
155
  msgid "Enable"
155
- msgstr ""
156
+ msgstr "启用"
156
157
 
157
158
  msgid "Enable automatic deletion of mismatched host records from the Red Hat cloud"
158
159
  msgstr "启用自动删除来自红帽云的主机记录"
159
160
 
160
161
  msgid "Enable automatic deletion of mismatched host records from the Red Hat cloud. Ignored when using local Insights."
161
- msgstr ""
162
+ msgstr "启用自动删除来自红帽云的主机记录。在使用本地 Insights 时忽略。"
162
163
 
163
164
  msgid "Enable automatic synchronization of Insights recommendations from the Red Hat cloud"
164
165
  msgstr "启用来自红帽云的 Insights 建议自动同步"
165
166
 
166
167
  msgid "Enable automatic synchronization of Insights recommendations from the Red Hat cloud. Ignored when using local Insights."
167
- msgstr ""
168
+ msgstr "启用自动同步来自 Red Hat cloud 的 Insights 建议。在使用本地 Insights 时忽略。"
168
169
 
169
170
  msgid "Enable automatic upload of your host inventory to the Red Hat cloud. Ignored when using local Insights."
170
- msgstr ""
171
+ msgstr "启用自动将主机清单上传到红帽云。在使用本地 Insights 时会忽略。"
171
172
 
172
173
  msgid "Enable automatic upload of your hosts inventory to the Red Hat cloud"
173
174
  msgstr "启用自动将主机清单上传到红帽云"
@@ -179,7 +180,7 @@ msgid "Enable inventory upload"
179
180
  msgstr "启用清单上传"
180
181
 
181
182
  msgid "Enable vulnerability analysis"
182
- msgstr ""
183
+ msgstr "启用漏洞分析"
183
184
 
184
185
  msgid "Encountered an error while trying to access the server:"
185
186
  msgstr "在尝试访问服务器时遇到错误:"
@@ -191,22 +192,22 @@ msgid "Exclude installed packages from being uploaded to the Red Hat cloud"
191
192
  msgstr "将安装的软件包上传到红帽云"
192
193
 
193
194
  msgid "Exclude installed packages from being uploaded to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored and installed packages are always excluded.) Ignored when using local Insights."
194
- msgstr ""
195
+ msgstr "在上传到红帽云时排除安装的软件包。(如果 insights_minimal_data_collection 设置为 true,则忽略此设置,且安装的软件包始终被排除。)在使用本地 Insights 时忽略。"
195
196
 
196
197
  msgid "Exit Code: %s"
197
198
  msgstr "退出代码:%s"
198
199
 
199
200
  msgid "Failed"
200
- msgstr ""
201
+ msgstr "失败"
201
202
 
202
203
  msgid "Failed to destroy HBI host %s: %s"
203
- msgstr ""
204
+ msgstr "销毁 HBI 主机 %s 失败:%s"
204
205
 
205
206
  msgid "Failed to fetch hosts"
206
- msgstr ""
207
+ msgstr "获取主机失败"
207
208
 
208
209
  msgid "Failed to update vulnerability analysis status"
209
- msgstr ""
210
+ msgstr "更新漏洞分析状态失败"
210
211
 
211
212
  msgid "Fetch Insights-related host details"
212
213
  msgstr "获取与 Insights 相关的主机详情"
@@ -245,7 +246,7 @@ msgid "Generate the report, but do not upload"
245
246
  msgstr "生成报告,但不上传"
246
247
 
247
248
  msgid "Generated"
248
- msgstr ""
249
+ msgstr "生成"
249
250
 
250
251
  msgid "Generating"
251
252
  msgstr "生成中"
@@ -272,7 +273,7 @@ msgid "Host Insights recommendations"
272
273
  msgstr "主机 Insights 建议"
273
274
 
274
275
  msgid "Host inventory report job"
275
- msgstr ""
276
+ msgstr "主机清单报告作业"
276
277
 
277
278
  msgid "Host was not uploaded to your RH cloud inventory"
278
279
  msgstr "主机没有上传到您的 RH 云清单"
@@ -296,7 +297,7 @@ msgid "Insights"
296
297
  msgstr "Insights"
297
298
 
298
299
  msgid "Invalid response from server"
299
- msgstr ""
300
+ msgstr "来自服务器的无效响应"
300
301
 
301
302
  msgid "Inventory"
302
303
  msgstr "清单"
@@ -335,7 +336,7 @@ msgid "Low"
335
336
  msgstr "低"
336
337
 
337
338
  msgid "Manage vulnerability analysis"
338
- msgstr ""
339
+ msgstr "管理漏洞分析"
339
340
 
340
341
  msgid "Manual"
341
342
  msgstr "手册"
@@ -344,7 +345,7 @@ msgid "Minimal data collection"
344
345
  msgstr "最小数据收集"
345
346
 
346
347
  msgid "Missing Insights facets created: %s"
347
- msgstr ""
348
+ msgstr "缺失创建的 Insights 情况:%s"
348
349
 
349
350
  msgid "Moderate"
350
351
  msgstr "中等"
@@ -353,7 +354,7 @@ msgid "More details can be found in"
353
354
  msgstr "如需更多详细信息,请参阅"
354
355
 
355
356
  msgid "N/A"
356
- msgstr ""
357
+ msgstr "不适用"
357
358
 
358
359
  msgid "Next run: "
359
360
  msgstr "下一次运行 :"
@@ -362,31 +363,31 @@ msgid "No"
362
363
  msgstr "否"
363
364
 
364
365
  msgid "No account data available."
365
- msgstr ""
366
+ msgstr "没有可用的帐户数据。"
366
367
 
367
368
  msgid "No recent tasks"
368
- msgstr ""
369
+ msgstr "没有最近的任务"
369
370
 
370
371
  msgid "No recommendations were found for this host!"
371
372
  msgstr "没有找到此主机的建议!"
372
373
 
373
374
  msgid "No report generation tasks have been run yet."
374
- msgstr ""
375
+ msgstr "还没有运行报告生成任务。"
375
376
 
376
377
  msgid "No results found"
377
378
  msgstr "没有找到结果"
378
379
 
379
380
  msgid "No task history"
380
- msgstr ""
381
+ msgstr "没有任务历史记录"
381
382
 
382
383
  msgid "No task was found"
383
384
  msgstr "没有找到任务"
384
385
 
385
386
  msgid "No tasks have been run yet."
386
- msgstr ""
387
+ msgstr "还没有运行任何任务。"
387
388
 
388
389
  msgid "None of the selected hosts are registered"
389
- msgstr ""
390
+ msgstr "所选主机都没有注册"
390
391
 
391
392
  msgid "Not reporting"
392
393
  msgstr "未报告"
@@ -410,16 +411,16 @@ msgid "Obfuscate host names sent to the Red Hat cloud"
410
411
  msgstr "发送到红帽云的模糊主机名"
411
412
 
412
413
  msgid "Obfuscate host names sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host names are not included in the report.) Ignored when using local Insights."
413
- msgstr ""
414
+ msgstr "将发送到红帽云的主机名进行模糊化处理。(如果 insights_minimal_data_collection 设置为 true,则忽略此设置,因为报告中不包含主机名。)在使用本地 Insights 时忽略。"
414
415
 
415
416
  msgid "Obfuscate ipv4 addresses sent to the Red Hat cloud"
416
417
  msgstr "发送到红帽云的模糊 ipv4 地址"
417
418
 
418
419
  msgid "Obfuscate ipv4 addresses sent to the Red Hat cloud. (If insights_minimal_data_collection is set to true, this setting is ignored because host IPv4 addresses are not included in the report.) Ignored when using local Insights."
419
- msgstr ""
420
+ msgstr "将发送到红帽云的 ipv4 地址进行模糊化处理。(如果 insights_minimal_data_collection 设置为 true,则忽略此设置,因为报告中不包含 ipv4 地址。)在使用本地 Insights 时忽略。"
420
421
 
421
422
  msgid "Only include the minimum required data in inventory reports for uploading to Red Hat cloud. When this is true, installed packages are excluded from the report regardless of the exclude_installed_packages setting, and host names and IPv4 addresses are excluded from the report regardless of obfuscation settings. Ignored when using local Insights."
422
- msgstr ""
423
+ msgstr "在将数据上传到红帽云时在清单报告中包括最少需要的数据。当这是 true 时,无论 exclude_installed_packages 设置是什么,安装的软件包都排除在报告中,无论模糊化设置是什么,主机名和 IPv4 地址都不包括在报告中。在使用本地 Insights 时忽略。"
423
424
 
424
425
  msgid "Only send the minimum required data to Red Hat cloud, obfuscation settings are disabled"
425
426
  msgstr "仅将最低所需的数据发送到红帽云,禁用模糊设置"
@@ -434,19 +435,19 @@ msgid "Pagination"
434
435
  msgstr "分页"
435
436
 
436
437
  msgid "Paused"
437
- msgstr ""
438
+ msgstr "暂停"
438
439
 
439
440
  msgid "Playbook"
440
441
  msgstr "运行 playbook"
441
442
 
442
443
  msgid "Previous tasks will appear here."
443
- msgstr ""
444
+ msgstr "此处将显示前面的任务。"
444
445
 
445
446
  msgid "RH Cloud"
446
447
  msgstr "RH Cloud"
447
448
 
448
449
  msgid "RHC daemon id. Ignored when using local Insights."
449
- msgstr ""
450
+ msgstr "RHC 守护进程 ID。在使用本地 Insights 时忽略。"
450
451
 
451
452
  msgid "Read more about it in RH cloud insights"
452
453
  msgstr "在 RH Cloud insights 中了解更多有关它的信息"
@@ -497,16 +498,16 @@ msgid "Remediation summary"
497
498
  msgstr "补救概述"
498
499
 
499
500
  msgid "Report Generation"
500
- msgstr ""
501
+ msgstr "报告生成"
501
502
 
502
503
  msgid "Report generation and upload started"
503
- msgstr ""
504
+ msgstr "报告生成和上传已开始"
504
505
 
505
506
  msgid "Report generation started"
506
- msgstr ""
507
+ msgstr "报告生成开始"
507
508
 
508
509
  msgid "Report saved to"
509
- msgstr ""
510
+ msgstr "报告保持到"
510
511
 
511
512
  msgid "Reporting"
512
513
  msgstr "报告"
@@ -524,7 +525,7 @@ msgid "Run remediation playbook generated by Insights"
524
525
  msgstr "运行 Insights 生成的补救 playbook"
525
526
 
526
527
  msgid "Running"
527
- msgstr ""
528
+ msgstr "執行中"
528
529
 
529
530
  msgid "Satellite server has %{hits_count} recommendations by Red Hat"
530
531
  msgstr "Satellite 服务器有 %{hits_count} 个红帽提供的建议"
@@ -545,7 +546,7 @@ msgid "Settings"
545
546
  msgstr "设置"
546
547
 
547
548
  msgid "Should import include parameter tags from Foreman? Ignored when using local Insights."
548
- msgstr ""
549
+ msgstr "是否应该导入 Foreman 中的 include 参数标签?在使用本地 Insights 时忽略。"
549
550
 
550
551
  msgid "Show Advanced Settings"
551
552
  msgstr "显示高级设置"
@@ -554,10 +555,10 @@ msgid "Show if system is configured to use local iop-advisor-engine."
554
555
  msgstr "显示系统是否被配置为使用本地 iop-advisor-engine。"
555
556
 
556
557
  msgid "Single-host report job"
557
- msgstr ""
558
+ msgstr "单主机报告作业"
558
559
 
559
560
  msgid "Single-host report job for host %s"
560
- msgstr ""
561
+ msgstr "主机 %s 的单主机报告作业"
561
562
 
562
563
  msgid "Start inventory synchronization"
563
564
  msgstr "启动清单同步"
@@ -566,13 +567,13 @@ msgid "Start report generation"
566
567
  msgstr "开始报告生成"
567
568
 
568
569
  msgid "Started"
569
- msgstr ""
570
+ msgstr "已启动"
570
571
 
571
572
  msgid "Stopped"
572
- msgstr ""
573
+ msgstr "停止"
573
574
 
574
575
  msgid "Success"
575
- msgstr ""
576
+ msgstr "成功"
576
577
 
577
578
  msgid "Successfully synced hosts: "
578
579
  msgstr "成功同步的主机:"
@@ -611,7 +612,7 @@ msgid "There are no recommendations for your hosts"
611
612
  msgstr "没有适用于您的主机的建议"
612
613
 
613
614
  msgid "There were no missing Insights facets"
614
- msgstr ""
615
+ msgstr "没有缺失的 Insights 情况"
615
616
 
616
617
  msgid "This action will also enable automatic reports upload"
617
618
  msgstr "此操作还会启用自动报告上传"
@@ -632,7 +633,7 @@ msgid "Total risks"
632
633
  msgstr "总风险"
633
634
 
634
635
  msgid "Unknown"
635
- msgstr ""
636
+ msgstr "未知"
636
637
 
637
638
  msgid "Upload hits from iop-advisor-engine"
638
639
  msgstr "从 iop-advisor-engine 上传 hits"
@@ -641,13 +642,13 @@ msgid "Upload hits information"
641
642
  msgstr "上传 hits 信息"
642
643
 
643
644
  msgid "Upload is disabled because subscription connection is not enabled. Enable it in Administer > Settings > Content."
644
- msgstr ""
645
+ msgstr "上传被禁用,因为订阅连接没有启用。通过 Administer > Settings > Content 启用。"
645
646
 
646
647
  msgid "Upload rules related to the hits"
647
648
  msgstr "上传与 hits 相关的 rule"
648
649
 
649
650
  msgid "Uploaded"
650
- msgstr ""
651
+ msgstr "已上传"
651
652
 
652
653
  msgid "Uploading"
653
654
  msgstr "上载中"
@@ -662,10 +663,10 @@ msgid "View in Red Hat Insights"
662
663
  msgstr "禁用 Red Hat Insights"
663
664
 
664
665
  msgid "View task"
665
- msgstr ""
666
+ msgstr "查看任务"
666
667
 
667
668
  msgid "View task details"
668
- msgstr ""
669
+ msgstr "查看任务详情"
669
670
 
670
671
  msgid "Vulnerabilities"
671
672
  msgstr "安全漏洞"
@@ -674,22 +675,22 @@ msgid "Vulnerability"
674
675
  msgstr "安全漏洞"
675
676
 
676
677
  msgid "Vulnerability analysis disabled"
677
- msgstr ""
678
+ msgstr "禁用漏洞分析"
678
679
 
679
680
  msgid "Vulnerability analysis enabled"
680
- msgstr ""
681
+ msgstr "启用漏洞分析"
681
682
 
682
683
  msgid "Wait and %s"
683
684
  msgstr "等待和 %s"
684
685
 
685
686
  msgid "Warning"
686
- msgstr ""
687
+ msgstr "警告"
687
688
 
688
689
  msgid "Whether the resolution requires reboot"
689
690
  msgstr "resolution 是否需要重启"
690
691
 
691
692
  msgid "You do not have permission to perform this action"
692
- msgstr ""
693
+ msgstr "您没有执行此操作的权限"
693
694
 
694
695
  msgid "category name"
695
696
  msgstr "类别名称"
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "14.0.2",
3
+ "version": "14.1.0",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,7 @@ require 'rest-client'
4
4
  module InsightsCloud::Api
5
5
  class MachineTelemetriesControllerTest < ActionController::TestCase
6
6
  include KatelloCVEHelper
7
+ include CandlepinIsolation
7
8
 
8
9
  setup do
9
10
  FactoryBot.create(:common_parameter, name: InsightsCloud.enable_client_param, key_type: 'boolean', value: true)
@@ -170,6 +171,45 @@ module InsightsCloud::Api
170
171
 
171
172
  assert_not_nil InsightsFacet.find_by(host_id: @host.id)
172
173
  end
174
+
175
+ test "should update InsightsClientReportStatus when parameter is false and block request" do
176
+ # Remove the common parameter from setup and set it to false
177
+ CommonParameter.where(name: InsightsCloud.enable_client_param).delete_all
178
+ FactoryBot.create(:common_parameter, name: InsightsCloud.enable_client_param, key_type: 'boolean', value: false)
179
+
180
+ # Stub telemetry_config to return false (disabled)
181
+ InsightsCloud::Api::MachineTelemetriesController.any_instance.stubs(:telemetry_config).returns(false)
182
+
183
+ get :forward_request, params: { "path" => "platform/ingress/v1/upload" }
184
+
185
+ # Request should be blocked
186
+ assert_response 403
187
+ assert_equal 'Telemetry is not enabled for this host', JSON.parse(@response.body)['message']
188
+
189
+ # But status should be updated to USER_OMITTED
190
+ @host.reload
191
+ insights_status = @host.get_status(InsightsClientReportStatus)
192
+ assert insights_status.persisted?, 'InsightsClientReportStatus should be created'
193
+ assert_equal InsightsClientReportStatus::USER_OMITTED, insights_status.status
194
+ end
195
+
196
+ test "should update InsightsClientReportStatus on successful upload" do
197
+ # Stub telemetry_config to return true (enabled) - common param from setup works for this
198
+ InsightsCloud::Api::MachineTelemetriesController.any_instance.stubs(:telemetry_config).returns(true)
199
+
200
+ net_http_resp = Net::HTTPResponse.new(1.0, 200, "OK")
201
+ res = RestClient::Response.create('response body', net_http_resp, @http_req)
202
+ ::ForemanRhCloud::CloudRequestForwarder.any_instance.stubs(:forward_request).returns(res)
203
+
204
+ get :forward_request, params: { "path" => "/redhat_access/r/insights/uploads/" }
205
+
206
+ assert_response :success
207
+
208
+ # Status should have been refreshed during the request
209
+ @host.reload
210
+ insights_status = @host.get_status(InsightsClientReportStatus)
211
+ assert insights_status.persisted?, 'InsightsClientReportStatus should be created and persisted'
212
+ end
173
213
  end
174
214
 
175
215
  context '#branch_info' do
@@ -0,0 +1,70 @@
1
+ require 'test_plugin_helper'
2
+
3
+ module InsightsCloud
4
+ class CandlepinProxiesExtensionsTest < ActiveSupport::TestCase
5
+ setup do
6
+ @organization = FactoryBot.create(:organization)
7
+ @host = FactoryBot.create(:host, :with_subscription, :managed, organization: @organization)
8
+ end
9
+
10
+ test 'updates InsightsClientReportStatus to USER_OMITTED when parameter is false' do
11
+ # Set parameter to false so status should be USER_OMITTED
12
+ FactoryBot.create(:common_parameter, name: 'host_registration_insights', key_type: 'boolean', value: false)
13
+
14
+ # Simulate what the callback does
15
+ @host.get_status(InsightsClientReportStatus).refresh!
16
+ @host.refresh_global_status!
17
+
18
+ # Verify the status was updated
19
+ @host.reload
20
+ insights_status = @host.get_status(InsightsClientReportStatus)
21
+ assert insights_status.persisted?, 'InsightsClientReportStatus should be persisted'
22
+ assert_equal InsightsClientReportStatus::USER_OMITTED, insights_status.status,
23
+ 'Status should be USER_OMITTED when host_registration_insights=false'
24
+ end
25
+
26
+ test 'sets USER_OMITTED status when parameter is inherited from hostgroup' do
27
+ # Create hostgroup with parameter
28
+ hostgroup = FactoryBot.create(:hostgroup)
29
+ hostgroup.group_parameters << GroupParameter.create(
30
+ name: 'host_registration_insights',
31
+ value: 'false',
32
+ key_type: 'boolean'
33
+ )
34
+ hostgroup.save!
35
+
36
+ @host.hostgroup = hostgroup
37
+ @host.save!
38
+
39
+ # Simulate what the callback does
40
+ @host.get_status(InsightsClientReportStatus).refresh!
41
+ @host.refresh_global_status!
42
+
43
+ # Verify status respects inherited parameter
44
+ @host.reload
45
+ insights_status = @host.get_status(InsightsClientReportStatus)
46
+ assert_equal InsightsClientReportStatus::USER_OMITTED, insights_status.status,
47
+ 'Status should be USER_OMITTED when host_registration_insights=false is inherited from hostgroup'
48
+ end
49
+
50
+ test 'refreshes global status' do
51
+ FactoryBot.create(:common_parameter, name: 'host_registration_insights', key_type: 'boolean', value: true)
52
+
53
+ # Simulate what the callback does
54
+ @host.get_status(InsightsClientReportStatus).refresh!
55
+ @host.refresh_global_status!
56
+
57
+ # Verify global status was updated
58
+ @host.reload
59
+ assert_not_nil @host.global_status, 'Global status should be set'
60
+ end
61
+
62
+ test 'CandlepinProxiesController includes the update_insights_client_status method' do
63
+ # Verify the concern is included and method is available
64
+ controller = Katello::Api::Rhsm::CandlepinProxiesController.new
65
+
66
+ assert_respond_to controller, :update_insights_client_status,
67
+ 'CandlepinProxiesController should have update_insights_client_status method from concern'
68
+ end
69
+ end
70
+ end
@@ -31,4 +31,44 @@ class InsightsClientStatusAgingTest < ActiveSupport::TestCase
31
31
  assert_equal InsightsClientReportStatus::NO_REPORT, @host3.get_status(InsightsClientReportStatus).status
32
32
  assert_equal InsightsClientReportStatus::NO_REPORT, @host4.get_status(InsightsClientReportStatus).status
33
33
  end
34
+
35
+ test 'aging job does not affect USER_OMITTED hosts' do
36
+ # Host 1: USER_OMITTED with old reported_at (should stay USER_OMITTED)
37
+ InsightsClientReportStatus.find_or_initialize_by(host_id: @host1.id).update(
38
+ status: InsightsClientReportStatus::USER_OMITTED,
39
+ reported_at: Time.now - InsightsClientReportStatus::REPORT_INTERVAL - 1.day
40
+ )
41
+
42
+ # Host 2: REPORTING with old reported_at (should change to NO_REPORT)
43
+ InsightsClientReportStatus.find_or_initialize_by(host_id: @host2.id).update(
44
+ status: InsightsClientReportStatus::REPORTING,
45
+ reported_at: Time.now - InsightsClientReportStatus::REPORT_INTERVAL - 1.day
46
+ )
47
+
48
+ # Host 3: USER_OMITTED with recent reported_at (should stay USER_OMITTED)
49
+ InsightsClientReportStatus.find_or_initialize_by(host_id: @host3.id).update(
50
+ status: InsightsClientReportStatus::USER_OMITTED,
51
+ reported_at: Time.now - 1.day
52
+ )
53
+
54
+ # Host 4: REPORTING with recent reported_at (should stay REPORTING)
55
+ InsightsClientReportStatus.find_or_initialize_by(host_id: @host4.id).update(
56
+ status: InsightsClientReportStatus::REPORTING,
57
+ reported_at: Time.now - 1.day
58
+ )
59
+
60
+ action = create_and_plan_action(InsightsCloud::Async::InsightsClientStatusAging)
61
+ run_action(action)
62
+
63
+ @hosts.each(&:reload)
64
+
65
+ assert_equal InsightsClientReportStatus::USER_OMITTED, @host1.get_status(InsightsClientReportStatus).status,
66
+ 'USER_OMITTED host with old report should stay USER_OMITTED'
67
+ assert_equal InsightsClientReportStatus::NO_REPORT, @host2.get_status(InsightsClientReportStatus).status,
68
+ 'REPORTING host with old report should change to NO_REPORT'
69
+ assert_equal InsightsClientReportStatus::USER_OMITTED, @host3.get_status(InsightsClientReportStatus).status,
70
+ 'USER_OMITTED host with recent report should stay USER_OMITTED'
71
+ assert_equal InsightsClientReportStatus::REPORTING, @host4.get_status(InsightsClientReportStatus).status,
72
+ 'REPORTING host with recent report should stay REPORTING'
73
+ end
34
74
  end