foreman_rh_cloud 12.2.10 → 13.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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_rh_cloud/locale/fr/foreman_rh_cloud.js +17 -50
  3. data/app/assets/javascripts/foreman_rh_cloud/locale/ja/foreman_rh_cloud.js +17 -50
  4. data/app/assets/javascripts/foreman_rh_cloud/locale/ka/foreman_rh_cloud.js +16 -49
  5. data/app/assets/javascripts/foreman_rh_cloud/locale/ko/foreman_rh_cloud.js +17 -50
  6. data/app/assets/javascripts/foreman_rh_cloud/locale/zh_CN/foreman_rh_cloud.js +17 -50
  7. data/app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb +3 -2
  8. data/app/models/insights_hit.rb +1 -1
  9. data/app/services/foreman_rh_cloud/cert_auth.rb +3 -13
  10. data/app/services/foreman_rh_cloud/gateway_request.rb +26 -0
  11. data/app/services/foreman_rh_cloud/insights_api_forwarder.rb +1 -3
  12. data/app/services/foreman_rh_cloud/tags_auth.rb +1 -2
  13. data/lib/foreman_inventory_upload/async/generate_report_job.rb +8 -13
  14. data/lib/foreman_inventory_upload/async/queue_for_upload_job.rb +4 -4
  15. data/lib/foreman_inventory_upload/async/upload_report_job.rb +5 -6
  16. data/lib/foreman_inventory_upload/generators/fact_helpers.rb +2 -2
  17. data/lib/foreman_inventory_upload/generators/slice.rb +3 -3
  18. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +1 -7
  19. data/lib/foreman_rh_cloud/engine.rb +15 -33
  20. data/lib/foreman_rh_cloud/plugin.rb +9 -9
  21. data/lib/foreman_rh_cloud/version.rb +1 -1
  22. data/lib/tasks/rh_cloud_inventory.rake +31 -14
  23. data/locale/foreman_rh_cloud.pot +152 -219
  24. data/locale/fr/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  25. data/locale/fr/foreman_rh_cloud.po +18 -50
  26. data/locale/ja/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  27. data/locale/ja/foreman_rh_cloud.po +18 -50
  28. data/locale/ka/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  29. data/locale/ka/foreman_rh_cloud.po +17 -49
  30. data/locale/ko/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  31. data/locale/ko/foreman_rh_cloud.po +18 -50
  32. data/locale/zh_CN/LC_MESSAGES/foreman_rh_cloud.mo +0 -0
  33. data/locale/zh_CN/foreman_rh_cloud.po +18 -50
  34. data/package.json +1 -1
  35. data/test/jobs/upload_report_job_test.rb +1 -2
  36. data/test/unit/fact_helpers_test.rb +0 -47
  37. data/test/unit/slice_generator_test.rb +0 -57
  38. data/webpack/ForemanRhCloudFills.js +2 -6
  39. data/webpack/ForemanRhCloudHelpers.js +0 -4
  40. data/webpack/InsightsHostDetailsTab/InsightsTab.scss +0 -4
  41. data/webpack/InsightsHostDetailsTab/InsightsTotalRiskChart.js +23 -59
  42. data/webpack/InsightsHostDetailsTab/NewHostDetailsTab.js +16 -3
  43. data/webpack/__tests__/ForemanRhCloudHelpers.test.js +1 -16
  44. data/webpack/__tests__/__snapshots__/ForemanRhCloudHelpers.test.js.snap +0 -6
  45. metadata +4 -10
  46. data/lib/foreman_inventory_upload/async/create_missing_insights_facets.rb +0 -29
  47. data/lib/foreman_inventory_upload/async/generate_host_report.rb +0 -20
  48. data/lib/foreman_inventory_upload/async/host_inventory_report_job.rb +0 -39
  49. data/lib/foreman_inventory_upload/async/single_host_report_job.rb +0 -20
  50. data/test/jobs/queue_for_upload_job_test.rb +0 -63
  51. data/webpack/InsightsHostDetailsTab/__tests__/InsightsTotalRiskChart.test.js +0 -194
@@ -35,9 +35,6 @@
35
35
  "All recommendations are now selected.": [
36
36
  "모든 권장 사항이 선택되었습니다."
37
37
  ],
38
- "Analytics data collection": [
39
- ""
40
- ],
41
38
  "Any Organization": [
42
39
  "모든 조직 "
43
40
  ],
@@ -137,14 +134,17 @@
137
134
  "Encountered an error while trying to access the server:": [
138
135
  "서버에 접근하는 동안 오류가 발생했습니다:"
139
136
  ],
140
- "Exclude installed packages": [
141
- ""
137
+ "Exclude installed Packages": [
138
+ "설치된 패키지 제외"
142
139
  ],
143
140
  "Exclude installed packages from being uploaded to the Red Hat cloud": [
144
141
  "설치된 패키지가 Red Hat 클라우드에 업로드되는 것을 제외합니다."
145
142
  ],
146
- "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.)": [
147
- ""
143
+ "Exclude packages": [
144
+ "패키지 제외"
145
+ ],
146
+ "Exclude packages from being uploaded to the Red Hat cloud": [
147
+ "Red Hat 클라우드에 업로드되는 패키지 제외"
148
148
  ],
149
149
  "Exit Code: %s": [
150
150
  "종료 코드: %s"
@@ -179,9 +179,6 @@
179
179
  "Generate and upload report": [
180
180
  "보고서 생성 및 업로드"
181
181
  ],
182
- "Generate report": [
183
- ""
184
- ],
185
182
  "Generate the report, but do not upload": [
186
183
  "보고서를 생성하되 업로드하지 마십시오."
187
184
  ],
@@ -251,9 +248,6 @@
251
248
  "Knowledgebase article": [
252
249
  "지식베이스 문서"
253
250
  ],
254
- "Learn more about {minimalDataCollectionSetting}.": [
255
- ""
256
- ],
257
251
  "List of host UUIDs": [
258
252
  "호스트 UUID 목록"
259
253
  ],
@@ -269,9 +263,6 @@
269
263
  "Manual": [
270
264
  "수동"
271
265
  ],
272
- "Minimal data collection": [
273
- ""
274
- ],
275
266
  "Moderate": [
276
267
  "중간 수준"
277
268
  ],
@@ -302,33 +293,21 @@
302
293
  "Notice": [
303
294
  "주의 "
304
295
  ],
296
+ "Obfuscate IPs": [
297
+ "IP 난독화"
298
+ ],
305
299
  "Obfuscate host ipv4 addresses": [
306
300
  "호스트 ipv4 주소 난독화"
307
301
  ],
308
- "Obfuscate host ipv4 addresses.": [
309
- ""
310
- ],
311
302
  "Obfuscate host names": [
312
303
  "호스트 이름 난독화"
313
304
  ],
314
305
  "Obfuscate host names sent to the Red Hat cloud": [
315
306
  "Red Hat 클라우드로 전송된 호스트 이름을 난독화합니다."
316
307
  ],
317
- "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.)": [
318
- ""
319
- ],
320
308
  "Obfuscate ipv4 addresses sent to the Red Hat cloud": [
321
309
  "Red Hat 클라우드로 전송된 ipv4 주소 난독화"
322
310
  ],
323
- "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.)": [
324
- ""
325
- ],
326
- "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.": [
327
- ""
328
- ],
329
- "Only send the minimum required data to Red Hat cloud, obfuscation settings are disabled": [
330
- ""
331
- ],
332
311
  "Oops! Couldn't find organization that matches your query": [
333
312
  "죄송합니다! 귀하의 쿼리와 일치하는 조직을 찾을 수 없습니다."
334
313
  ],
@@ -347,6 +326,9 @@
347
326
  "RHC daemon id": [
348
327
  "RHC 데몬 ID"
349
328
  ],
329
+ "RHCloud": [
330
+ "RHCloud"
331
+ ],
350
332
  "Read more about it in RH cloud insights": [
351
333
  "RH 클라우드 Insights에서 이에 대해 자세히 알아보세요."
352
334
  ],
@@ -404,8 +386,8 @@
404
386
  "Run RH Cloud playbook": [
405
387
  "RH Cloud playbook 실행"
406
388
  ],
407
- "Run playbook generated by Red Hat remediations app": [
408
- ""
389
+ "Run playbook genrated by Red Hat remediations app": [
390
+ "Red Hat Remediations 앱에서 생성된 playbook 실행"
409
391
  ],
410
392
  "Run remediation playbook generated by Insights": [
411
393
  "Insights에서 생성된 수정 playbook 실행"
@@ -419,9 +401,6 @@
419
401
  "Select recommendations from all pages": [
420
402
  "모든 페이지에서 추천을 선택하세요"
421
403
  ],
422
- "Send additional data to enhance Insights services, as per the settings": [
423
- ""
424
- ],
425
404
  "Set the current organization context for the request": [
426
405
  "요청에 대한 현재 조직 컨텍스트 설정"
427
406
  ],
@@ -467,8 +446,8 @@
467
446
  "The report file %{filename} doesn't exist": [
468
447
  "보고서 파일%{filename}이/가 존재하지 않습니다"
469
448
  ],
470
- "The scheduled process is disabled because this Foreman is configured with a local IoP Smart Proxy.": [
471
- ""
449
+ "The scheduled process is disabled because this Foreman is configured with the use_local_advisor_engine option.": [
450
+ "예약된 프로세스는 이 Foreman이 use_local_advisor_engine 옵션으로 구성되어 있기 때문에 비활성화되었습니다."
472
451
  ],
473
452
  "The server returned the following error: %s": [
474
453
  "서버에서 다음 오류가 반환되었습니다. %s"
@@ -488,9 +467,6 @@
488
467
  "To manually upload the data for a specific organization, select an organization and click {restartButtonName}.": [
489
468
  "특정 조직에 대한 데이터를 수동으로 업로드하려면 조직을 선택하고 {restartButtonName}를 클릭하십시오."
490
469
  ],
491
- "Total CVEs": [
492
- ""
493
- ],
494
470
  "Total risk": [
495
471
  "총 위험"
496
472
  ],
@@ -518,12 +494,6 @@
518
494
  "View in Red Hat Insights": [
519
495
  "Red Hat Insights에서 보기"
520
496
  ],
521
- "Vulnerabilities": [
522
- ""
523
- ],
524
- "Vulnerability": [
525
- ""
526
- ],
527
497
  "Wait and %s": [
528
498
  "대기 및 %s"
529
499
  ],
@@ -590,9 +560,6 @@
590
560
  "rule title": [
591
561
  "규칙 제목"
592
562
  ],
593
- "setting minimal data collection": [
594
- ""
595
- ],
596
563
  "solution url": [
597
564
  "솔루션 URL"
598
565
  ],
@@ -35,9 +35,6 @@
35
35
  "All recommendations are now selected.": [
36
36
  "现在选择了所有建议。"
37
37
  ],
38
- "Analytics data collection": [
39
- ""
40
- ],
41
38
  "Any Organization": [
42
39
  "任意机构"
43
40
  ],
@@ -137,14 +134,17 @@
137
134
  "Encountered an error while trying to access the server:": [
138
135
  "在尝试访问服务器时遇到错误:"
139
136
  ],
140
- "Exclude installed packages": [
141
- ""
137
+ "Exclude installed Packages": [
138
+ "排除安装的软件包"
142
139
  ],
143
140
  "Exclude installed packages from being uploaded to the Red Hat cloud": [
144
141
  "将安装的软件包上传到红帽云"
145
142
  ],
146
- "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.)": [
147
- ""
143
+ "Exclude packages": [
144
+ "排除软件包"
145
+ ],
146
+ "Exclude packages from being uploaded to the Red Hat cloud": [
147
+ "排除软件包上传到红帽云"
148
148
  ],
149
149
  "Exit Code: %s": [
150
150
  "退出代码:%s"
@@ -179,9 +179,6 @@
179
179
  "Generate and upload report": [
180
180
  "生成并上传报告"
181
181
  ],
182
- "Generate report": [
183
- ""
184
- ],
185
182
  "Generate the report, but do not upload": [
186
183
  "生成报告,但不上传"
187
184
  ],
@@ -251,9 +248,6 @@
251
248
  "Knowledgebase article": [
252
249
  "知识库文章"
253
250
  ],
254
- "Learn more about {minimalDataCollectionSetting}.": [
255
- ""
256
- ],
257
251
  "List of host UUIDs": [
258
252
  "主机 UUID 列表"
259
253
  ],
@@ -269,9 +263,6 @@
269
263
  "Manual": [
270
264
  "手册"
271
265
  ],
272
- "Minimal data collection": [
273
- ""
274
- ],
275
266
  "Moderate": [
276
267
  "中等"
277
268
  ],
@@ -302,33 +293,21 @@
302
293
  "Notice": [
303
294
  "注意事項"
304
295
  ],
296
+ "Obfuscate IPs": [
297
+ "模糊 IP"
298
+ ],
305
299
  "Obfuscate host ipv4 addresses": [
306
300
  "模糊的主机 ipv4 地址"
307
301
  ],
308
- "Obfuscate host ipv4 addresses.": [
309
- ""
310
- ],
311
302
  "Obfuscate host names": [
312
303
  "模糊主机名"
313
304
  ],
314
305
  "Obfuscate host names sent to the Red Hat cloud": [
315
306
  "发送到红帽云的模糊主机名"
316
307
  ],
317
- "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.)": [
318
- ""
319
- ],
320
308
  "Obfuscate ipv4 addresses sent to the Red Hat cloud": [
321
309
  "发送到红帽云的模糊 ipv4 地址"
322
310
  ],
323
- "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.)": [
324
- ""
325
- ],
326
- "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.": [
327
- ""
328
- ],
329
- "Only send the minimum required data to Red Hat cloud, obfuscation settings are disabled": [
330
- ""
331
- ],
332
311
  "Oops! Couldn't find organization that matches your query": [
333
312
  "未找到与您的查询匹配的机构"
334
313
  ],
@@ -347,6 +326,9 @@
347
326
  "RHC daemon id": [
348
327
  "RHC 守护进程 ID"
349
328
  ],
329
+ "RHCloud": [
330
+ "RHCloud"
331
+ ],
350
332
  "Read more about it in RH cloud insights": [
351
333
  "在 RH Cloud insights 中了解更多有关它的信息"
352
334
  ],
@@ -404,8 +386,8 @@
404
386
  "Run RH Cloud playbook": [
405
387
  "运行 RH Cloud playbook"
406
388
  ],
407
- "Run playbook generated by Red Hat remediations app": [
408
- ""
389
+ "Run playbook genrated by Red Hat remediations app": [
390
+ "运行由红帽补救应用生成的 playbook"
409
391
  ],
410
392
  "Run remediation playbook generated by Insights": [
411
393
  "运行 Insights 生成的补救 playbook"
@@ -419,9 +401,6 @@
419
401
  "Select recommendations from all pages": [
420
402
  "在所有页面中选择建议"
421
403
  ],
422
- "Send additional data to enhance Insights services, as per the settings": [
423
- ""
424
- ],
425
404
  "Set the current organization context for the request": [
426
405
  "设置请求的当前机构上下文"
427
406
  ],
@@ -467,8 +446,8 @@
467
446
  "The report file %{filename} doesn't exist": [
468
447
  "报告文件 %{filename} 不存在"
469
448
  ],
470
- "The scheduled process is disabled because this Foreman is configured with a local IoP Smart Proxy.": [
471
- ""
449
+ "The scheduled process is disabled because this Foreman is configured with the use_local_advisor_engine option.": [
450
+ "调度的进程被禁用,因为此 Foreman 配置了 use_local_advisor_engine 选项。"
472
451
  ],
473
452
  "The server returned the following error: %s": [
474
453
  "服务器返回以下错误:%s"
@@ -488,9 +467,6 @@
488
467
  "To manually upload the data for a specific organization, select an organization and click {restartButtonName}.": [
489
468
  "要手动上传特定机构的数据,请选择机构并点 {restartButtonName}。"
490
469
  ],
491
- "Total CVEs": [
492
- ""
493
- ],
494
470
  "Total risk": [
495
471
  "总风险"
496
472
  ],
@@ -518,12 +494,6 @@
518
494
  "View in Red Hat Insights": [
519
495
  "禁用 Red Hat Insights"
520
496
  ],
521
- "Vulnerabilities": [
522
- ""
523
- ],
524
- "Vulnerability": [
525
- ""
526
- ],
527
497
  "Wait and %s": [
528
498
  "等待和 %s"
529
499
  ],
@@ -590,9 +560,6 @@
590
560
  "rule title": [
591
561
  "rule 标题"
592
562
  ],
593
- "setting minimal data collection": [
594
- ""
595
- ],
596
563
  "solution url": [
597
564
  "solution url"
598
565
  ],
@@ -15,10 +15,11 @@ module InsightsCloud
15
15
  logger.debug("Generating host-specific report for host #{@host.name}")
16
16
 
17
17
  ForemanTasks.async_task(
18
- ForemanInventoryUpload::Async::SingleHostReportJob,
18
+ ForemanInventoryUpload::Async::GenerateReportJob,
19
19
  ForemanInventoryUpload.generated_reports_folder,
20
20
  @host.organization_id,
21
- @host.id
21
+ false,
22
+ "id=#{@host.id}"
22
23
  )
23
24
 
24
25
  # in IoP case, the hosts are identified by the sub-man ID, and we can assume they already
@@ -1,6 +1,6 @@
1
1
  class InsightsHit < ApplicationRecord
2
2
  include ::Authorizable
3
- belongs_to :host, class_name: 'Host::Base'
3
+ belongs_to :host
4
4
  # since the facet is one-to-one association with a host, we can connect
5
5
  # through host_id column on both this model and facet.
6
6
  belongs_to :insights_facet, foreign_key: 'host_id', primary_key: 'host_id', counter_cache: :hits_count
@@ -11,21 +11,11 @@ module ForemanRhCloud
11
11
 
12
12
  def execute_cloud_request(params)
13
13
  organization = params.delete(:organization)
14
- # Cache the value of with_iop_smart_proxy? to avoid multiple calls to the database
15
- with_iop_smart_proxy = ForemanRhCloud.with_iop_smart_proxy?
16
- certs = with_iop_smart_proxy ? foreman_certificate : candlepin_id_cert(organization)
17
- default_params = {
14
+ certs = ForemanRhCloud.with_iop_smart_proxy? ? foreman_certificate : candlepin_id_cert(organization)
15
+ final_params = {
18
16
  ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
19
17
  ssl_client_key: OpenSSL::PKey.read(certs[:key]),
20
- }
21
-
22
- if with_iop_smart_proxy && organization&.label
23
- default_params[:headers] = {
24
- 'X-Org-Id' => organization&.label,
25
- }
26
- end
27
-
28
- final_params = default_params.deep_merge(params)
18
+ }.deep_merge(params)
29
19
 
30
20
  super(final_params)
31
21
  end
@@ -0,0 +1,26 @@
1
+ module ForemanRhCloud
2
+ module GatewayRequest
3
+ extend ActiveSupport::Concern
4
+
5
+ include CloudRequest
6
+
7
+ def execute_cloud_request(params)
8
+ certs = params.delete(:certs) || foreman_certificates
9
+ final_params = {
10
+ ssl_client_cert: OpenSSL::X509::Certificate.new(certs[:cert]),
11
+ ssl_client_key: OpenSSL::PKey.read(certs[:key]),
12
+ ssl_ca_file: Setting[:ssl_ca_file],
13
+ verify_ssl: OpenSSL::SSL::VERIFY_PEER,
14
+ }.deep_merge(params)
15
+
16
+ super(final_params)
17
+ end
18
+
19
+ def foreman_certificates
20
+ {
21
+ cert: File.read(Setting[:ssl_certificate]),
22
+ key: File.read(Setting[:ssl_priv_key]),
23
+ }
24
+ end
25
+ end
26
+ end
@@ -2,7 +2,7 @@ require 'rest-client'
2
2
 
3
3
  module ForemanRhCloud
4
4
  class InsightsApiForwarder
5
- include ForemanRhCloud::CertAuth
5
+ include ForemanRhCloud::GatewayRequest
6
6
 
7
7
  SCOPED_REQUESTS = [
8
8
  { test: %r{api/vulnerability/v1/vulnerabilities/cves}, tag_name: :tags },
@@ -26,8 +26,6 @@ module ForemanRhCloud
26
26
 
27
27
  request_opts = prepare_request_opts(original_request, path, forward_payload, forward_params)
28
28
 
29
- request_opts[:organization] = organization
30
-
31
29
  logger.debug("Sending request to: #{request_opts[:url]}")
32
30
 
33
31
  execute_cloud_request(request_opts)
@@ -1,6 +1,6 @@
1
1
  module ForemanRhCloud
2
2
  class TagsAuth
3
- include CertAuth
3
+ include GatewayRequest
4
4
 
5
5
  TAG_NAMESPACE = 'sat_iam'.freeze
6
6
  TAG_SHORT_NAME = 'scope'.freeze
@@ -24,7 +24,6 @@ module ForemanRhCloud
24
24
 
25
25
  payload = tags_query_payload
26
26
  params = {
27
- organization: @org,
28
27
  method: :post,
29
28
  url: "#{InsightsCloud.gateway_url}/tags",
30
29
  headers: {
@@ -5,7 +5,7 @@ module ForemanInventoryUpload
5
5
  "report_for_#{label}"
6
6
  end
7
7
 
8
- def plan(base_folder, organization_id, disconnected = false, hosts_filter = nil)
8
+ def plan(base_folder, organization_id, disconnected, hosts_filter = nil)
9
9
  sequence do
10
10
  super(
11
11
  GenerateReportJob.output_label("#{organization_id}#{hosts_filter.empty? ? nil : "[#{hosts_filter.to_s.parameterize}]"}"),
@@ -14,14 +14,13 @@ module ForemanInventoryUpload
14
14
  hosts_filter: hosts_filter
15
15
  )
16
16
 
17
- unless content_disconnected?(disconnected)
18
- plan_action(
19
- QueueForUploadJob,
20
- base_folder,
21
- ForemanInventoryUpload.facts_archive_name(organization_id, hosts_filter),
22
- organization_id
23
- )
24
- end
17
+ plan_action(
18
+ QueueForUploadJob,
19
+ base_folder,
20
+ ForemanInventoryUpload.facts_archive_name(organization_id, hosts_filter),
21
+ organization_id,
22
+ disconnected
23
+ )
25
24
  end
26
25
  end
27
26
 
@@ -41,10 +40,6 @@ module ForemanInventoryUpload
41
40
  )
42
41
  end
43
42
 
44
- def content_disconnected?(disconnected)
45
- disconnected || !Setting[:subscription_connection_enabled]
46
- end
47
-
48
43
  def base_folder
49
44
  input[:base_folder]
50
45
  end
@@ -1,9 +1,9 @@
1
1
  module ForemanInventoryUpload
2
2
  module Async
3
3
  class QueueForUploadJob < ::Actions::EntryAction
4
- def plan(base_folder, report_file, organization_id)
4
+ def plan(base_folder, report_file, organization_id, disconnected)
5
5
  enqueue_task = plan_self(base_folder: base_folder, report_file: report_file)
6
- plan_upload_report(enqueue_task.output[:enqueued_file_name], organization_id)
6
+ plan_upload_report(enqueue_task.output[:enqueued_file_name], organization_id, disconnected)
7
7
  end
8
8
 
9
9
  def run
@@ -59,8 +59,8 @@ module ForemanInventoryUpload
59
59
  input[:report_file]
60
60
  end
61
61
 
62
- def plan_upload_report(enqueued_file_name, organization_id)
63
- plan_action(UploadReportJob, enqueued_file_name, organization_id)
62
+ def plan_upload_report(enqueued_file_name, organization_id, disconnected)
63
+ plan_action(UploadReportJob, enqueued_file_name, organization_id, disconnected)
64
64
  end
65
65
  end
66
66
  end
@@ -7,15 +7,15 @@ module ForemanInventoryUpload
7
7
  "upload_for_#{label}"
8
8
  end
9
9
 
10
- def plan(filename, organization_id)
10
+ def plan(filename, organization_id, disconnected = false)
11
11
  label = UploadReportJob.output_label(organization_id)
12
- super(label, filename: filename, organization_id: organization_id)
12
+ super(label, filename: filename, organization_id: organization_id, disconnected: disconnected)
13
13
  end
14
14
 
15
15
  def try_execute
16
16
  if content_disconnected?
17
17
  progress_output do |progress_output|
18
- progress_output.write_line("Report was not moved and upload was canceled because connection to Insights is not enabled. Report location: #{filename}.")
18
+ progress_output.write_line('Upload canceled because connection to Insights is not enabled or the --no-upload option was passed.')
19
19
  progress_output.status = "Task aborted, exit 1"
20
20
  done!
21
21
  end
@@ -48,8 +48,7 @@ module ForemanInventoryUpload
48
48
  def env
49
49
  env_vars = super.merge(
50
50
  'FILES' => filename,
51
- 'CER_PATH' => @cer_path,
52
- 'ORG_ID' => organization.label
51
+ 'CER_PATH' => @cer_path
53
52
  )
54
53
 
55
54
  http_proxy_string = ForemanRhCloud.http_proxy_string
@@ -90,7 +89,7 @@ module ForemanInventoryUpload
90
89
  end
91
90
 
92
91
  def content_disconnected?
93
- !Setting[:subscription_connection_enabled]
92
+ input[:disconnected] || !Setting[:subscription_connection_enabled]
94
93
  end
95
94
  end
96
95
  end
@@ -59,7 +59,7 @@ module ForemanInventoryUpload
59
59
  def obfuscate_hostname?(host)
60
60
  # Returns true if hostname obfuscation should be applied for a given host, based on hierarchy:
61
61
  # 1. Global setting for hostname obfuscation.
62
- return true if Setting[:obfuscate_inventory_hostnames] && !ForemanRhCloud.with_iop_smart_proxy?
62
+ return true if Setting[:obfuscate_inventory_hostnames]
63
63
 
64
64
  insights_client_setting = fact_value(host, 'insights_client::obfuscate_hostname_enabled')
65
65
  insights_client_setting = ActiveModel::Type::Boolean.new.cast(insights_client_setting)
@@ -99,7 +99,7 @@ module ForemanInventoryUpload
99
99
  def obfuscate_ips?(host)
100
100
  # Returns true if IP obfuscation should be applied for a given host, based on hierarchy:
101
101
  # 1. Global setting for IP obfuscation.
102
- return true if Setting[:obfuscate_inventory_ips] && !ForemanRhCloud.with_iop_smart_proxy?
102
+ return true if Setting[:obfuscate_inventory_ips]
103
103
 
104
104
  insights_client_ipv4_setting = fact_value(host, 'insights_client::obfuscate_ipv4_enabled')
105
105
  insights_client_ipv6_setting = fact_value(host, 'insights_client::obfuscate_ipv6_enabled')
@@ -90,7 +90,7 @@ module ForemanInventoryUpload
90
90
  def report_host(host)
91
91
  host_ips_cache = host_ips(host)
92
92
  @stream.object do
93
- if Setting[:insights_minimal_data_collection] && !ForemanRhCloud.with_iop_smart_proxy?
93
+ if Setting[:insights_minimal_data_collection]
94
94
  insights_minimal_data_collection(host)
95
95
  else
96
96
  @stream.simple_field('fqdn', fqdn(host))
@@ -205,7 +205,7 @@ module ForemanInventoryUpload
205
205
  end.join(', '))
206
206
  end
207
207
  end
208
- if ForemanRhCloud.with_iop_smart_proxy? || (!Setting[:insights_minimal_data_collection] && !Setting[:exclude_installed_packages])
208
+ if !Setting[:insights_minimal_data_collection] && !Setting[:exclude_installed_packages]
209
209
  @stream.array_field('installed_packages') do
210
210
  first = true
211
211
  host.installed_packages.each do |package|
@@ -256,7 +256,7 @@ module ForemanInventoryUpload
256
256
 
257
257
  @stream.array_field('yum_repos') do
258
258
  host.content_facet.bound_repositories.each_with_index do |repo, index|
259
- report_yum_repo(host.content_source&.load_balancer_pulp_content_url || ::SmartProxy.pulp_primary.pulp_content_url, repo)
259
+ report_yum_repo(host.content_source.load_balancer_pulp_content_url, repo)
260
260
  @stream.comma unless index == host.content_facet.bound_repositories.count - 1
261
261
  end
262
262
  end
@@ -27,12 +27,6 @@ else
27
27
  AUTH_VAL="\"$RH_USERNAME\":\"$RH_PASSWORD\""
28
28
  fi
29
29
 
30
- ORG_HEADER=()
31
- if [ -n "$ORG_ID" ]
32
- then
33
- + ORG_HEADER=("-H" "X-Org-Id: $ORG_ID")
34
- fi
35
-
36
30
  # /tmp/a b/x.pem
37
31
  # curl --cert /tmp/a\ b/x.pem
38
32
 
@@ -42,7 +36,7 @@ mkdir -p $DONE_DIR
42
36
 
43
37
  for f in $FILES
44
38
  do
45
- curl -k -vvv -# --fail -F "file=@$f;type=application/vnd.redhat.qpc.tar+tgz" $DEST "$AUTH_KEY" "$AUTH_VAL" "${ORG_HEADER[@]}"
39
+ curl -k -vvv -# --fail -F "file=@$f;type=application/vnd.redhat.qpc.tar+tgz" $DEST "$AUTH_KEY" "$AUTH_VAL"
46
40
  status=$?
47
41
  if [ $status -eq 0 ]; then
48
42
  mv $f $DONE_DIR