foreman_rh_cloud 3.0.18.1 → 4.0.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -5
  3. data/app/controllers/foreman_inventory_upload/tasks_controller.rb +14 -3
  4. data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +8 -0
  5. data/app/controllers/insights_cloud/api/machine_telemetries_controller.rb +17 -7
  6. data/app/controllers/insights_cloud/hits_controller.rb +37 -0
  7. data/app/controllers/insights_cloud/settings_controller.rb +1 -1
  8. data/app/controllers/insights_cloud/tasks_controller.rb +1 -2
  9. data/app/models/insights_client_report_status.rb +58 -0
  10. data/app/models/insights_resolution.rb +1 -1
  11. data/app/models/inventory_sync/inventory_status.rb +6 -0
  12. data/app/models/setting/rh_cloud.rb +5 -5
  13. data/app/services/foreman_rh_cloud/cloud_connector.rb +1 -1
  14. data/app/services/foreman_rh_cloud/remediations_retriever.rb +78 -0
  15. data/app/services/foreman_rh_cloud/template_renderer_helper.rb +22 -0
  16. data/app/subscribers/foreman_rh_cloud/insights_subscriber.rb +9 -0
  17. data/app/views/job_templates/rh_cloud_remediations.erb +14 -0
  18. data/config/routes.rb +2 -1
  19. data/db/migrate/20210404000001_change_resolutions.foreman_rh_cloud.rb +10 -0
  20. data/db/seeds.d/179_ui_notifications.rb +11 -0
  21. data/db/seeds.d/50_job_templates.rb +14 -0
  22. data/lib/foreman_inventory_upload.rb +9 -0
  23. data/lib/foreman_inventory_upload/async/generate_all_reports_job.rb +8 -2
  24. data/lib/foreman_inventory_upload/generators/queries.rb +3 -2
  25. data/lib/foreman_inventory_upload/generators/slice.rb +1 -1
  26. data/lib/foreman_inventory_upload/generators/tags.rb +8 -6
  27. data/lib/foreman_inventory_upload/scripts/uploader.sh.erb +5 -1
  28. data/lib/foreman_rh_cloud.rb +18 -0
  29. data/lib/foreman_rh_cloud/engine.rb +36 -2
  30. data/lib/foreman_rh_cloud/version.rb +1 -1
  31. data/lib/insights_cloud.rb +12 -0
  32. data/lib/insights_cloud/async/insights_full_sync.rb +39 -24
  33. data/lib/insights_cloud/async/insights_generate_notifications.rb +58 -0
  34. data/lib/insights_cloud/async/insights_resolutions_sync.rb +69 -0
  35. data/lib/insights_cloud/async/insights_rules_sync.rb +13 -17
  36. data/lib/insights_cloud/async/insights_scheduled_sync.rb +1 -1
  37. data/lib/inventory_sync/async/host_result.rb +11 -6
  38. data/lib/inventory_sync/async/inventory_full_sync.rb +24 -41
  39. data/lib/inventory_sync/async/inventory_hosts_sync.rb +34 -0
  40. data/lib/inventory_sync/async/inventory_scheduled_sync.rb +17 -0
  41. data/lib/inventory_sync/async/query_inventory_job.rb +54 -0
  42. data/lib/tasks/insights.rake +4 -12
  43. data/lib/tasks/rh_cloud_inventory.rake +12 -4
  44. data/package.json +1 -1
  45. data/test/factories/insights_factories.rb +22 -0
  46. data/test/jobs/insights_full_sync_test.rb +28 -15
  47. data/test/jobs/insights_resolutions_sync_test.rb +77 -0
  48. data/test/jobs/insights_rules_sync_test.rb +8 -3
  49. data/test/jobs/inventory_full_sync_test.rb +185 -12
  50. data/test/models/insights_client_report_status_test.rb +77 -0
  51. data/test/unit/rh_cloud_http_proxy_test.rb +4 -4
  52. data/test/unit/services/foreman_rh_cloud/remediations_retriever_test.rb +49 -0
  53. data/test/unit/services/foreman_rh_cloud/template_renderer_helper_test.rb +28 -0
  54. data/test/unit/slice_generator_test.rb +11 -2
  55. data/test/unit/tags_generator_test.rb +10 -0
  56. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +1 -1
  57. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/__tests__/__snapshots__/FullScreenModal.test.js.snap +1 -1
  58. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +14 -16
  59. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +1 -1
  60. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/__snapshots__/integration.test.js.snap +0 -1
  61. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants.js +5 -3
  62. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/PageDescription.js +15 -2
  63. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/PageDescription/__tests__/__snapshots__/PageDescription.test.js.snap +13 -2
  64. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonActions.js +81 -46
  65. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonConstants.js +3 -3
  66. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonSelectors.js +6 -12
  67. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonFixtures.js +1 -9
  68. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonSelectors.test.js +18 -27
  69. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonSelectors.test.js.snap +1 -16
  70. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/integrations.test.js.snap +58 -0
  71. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +51 -0
  72. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +2 -5
  73. data/webpack/ForemanInventoryUpload/Components/Terminal/Terminal.js +1 -1
  74. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/Terminal.test.js +1 -1
  75. data/webpack/ForemanInventoryUpload/Components/Terminal/__tests__/__snapshots__/Terminal.test.js.snap +2 -2
  76. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +25 -27
  77. data/webpack/ForemanInventoryUpload/ForemanInventoryUploadReducers.js +0 -2
  78. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTable.js +1 -1
  79. data/webpack/InsightsCloudSync/Components/InsightsTable/InsightsTableSelectors.js +3 -0
  80. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/__snapshots__/InsightsTable.test.js.snap +2 -0
  81. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediateButton.js +59 -0
  82. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationActions.js +12 -0
  83. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationHelpers.js +43 -0
  84. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.js +101 -0
  85. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModal.scss +9 -0
  86. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationModalFooter.js +43 -0
  87. data/webpack/InsightsCloudSync/Components/RemediationModal/RemediationTableConstants.js +38 -0
  88. data/webpack/InsightsCloudSync/Components/RemediationModal/Resolutions.js +55 -0
  89. data/webpack/InsightsCloudSync/Components/RemediationModal/index.js +34 -0
  90. data/webpack/InsightsCloudSync/InsightsCloudSync.js +8 -3
  91. data/webpack/InsightsCloudSync/InsightsCloudSync.scss +5 -0
  92. data/webpack/InsightsCloudSync/__snapshots__/InsightsCloudSync.test.js.snap +9 -6
  93. data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +4 -0
  94. data/webpack/{InsightsCloudSync/Components/InsightsTable/components → common/table}/EmptyState.js +0 -0
  95. data/webpack/common/table/helpers.js +7 -0
  96. metadata +56 -26
  97. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/SyncButtonReducer.js +0 -36
  98. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonActions.test.js +0 -31
  99. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButtonReducer.test.js +0 -26
  100. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonActions.test.js.snap +0 -98
  101. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/__snapshots__/SyncButtonReducer.test.js.snap +0 -18
@@ -0,0 +1,69 @@
1
+ require 'rest-client'
2
+
3
+ module InsightsCloud
4
+ module Async
5
+ class InsightsResolutionsSync < ::Actions::EntryAction
6
+ include ::ForemanRhCloud::CloudAuth
7
+
8
+ RULE_ID_REGEX = /[^:]*:(?<id>.*)/
9
+
10
+ def run
11
+ InsightsResolution.transaction do
12
+ InsightsResolution.delete_all
13
+ api_response = query_insights_resolutions(relevant_rules)
14
+ write_resolutions(api_response)
15
+ end
16
+ end
17
+
18
+ def logger
19
+ action_logger
20
+ end
21
+
22
+ private
23
+
24
+ def query_insights_resolutions(rule_ids)
25
+ resolutions_response = RestClient::Request.execute(
26
+ method: :post,
27
+ url: InsightsCloud.resolutions_url,
28
+ verify_ssl: ForemanRhCloud.verify_ssl_method,
29
+ proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
30
+ headers: {
31
+ content_type: :json,
32
+ Authorization: "Bearer #{rh_credentials}",
33
+ },
34
+ payload: {
35
+ issues: rule_ids,
36
+ }.to_json
37
+ )
38
+
39
+ JSON.parse(resolutions_response)
40
+ end
41
+
42
+ def relevant_rules
43
+ InsightsRule.all.pluck(:rule_id).map { |id| InsightsCloud.remediation_rule_id(id) }
44
+ end
45
+
46
+ def to_resolution_hash(rule_id, resolution_hash)
47
+ {
48
+ rule_id: rule_id,
49
+ description: resolution_hash['description'],
50
+ resolution_type: resolution_hash['id'],
51
+ needs_reboot: resolution_hash['needs_reboot'],
52
+ resolution_risk: resolution_hash['resolution_risk'],
53
+ }
54
+ end
55
+
56
+ def write_resolutions(response)
57
+ all_resolutions = response.map do |rule_id, rule_details|
58
+ rule_details['resolutions'].map { |resolution| to_resolution_hash(to_rule_id(rule_id), resolution) }
59
+ end.flatten
60
+
61
+ InsightsResolution.create(all_resolutions)
62
+ end
63
+
64
+ def to_rule_id(resolution_rule_id)
65
+ RULE_ID_REGEX.match(resolution_rule_id).named_captures.fetch('id', resolution_rule_id)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -2,13 +2,21 @@ require 'rest-client'
2
2
 
3
3
  module InsightsCloud
4
4
  module Async
5
- class InsightsRulesSync < ::ApplicationJob
5
+ class InsightsRulesSync < ::Actions::EntryAction
6
6
  include ::ForemanRhCloud::CloudAuth
7
7
 
8
- def perform
8
+ def plan
9
+ plan_self
10
+ plan_resolutions
11
+ end
12
+
13
+ def plan_resolutions
14
+ plan_action InsightsResolutionsSync
15
+ end
16
+
17
+ def run
9
18
  offset = 0
10
19
  InsightsRule.transaction do
11
- InsightsResolution.delete_all
12
20
  InsightsRule.delete_all
13
21
  loop do
14
22
  api_response = query_insights_rules(offset)
@@ -16,13 +24,14 @@ module InsightsCloud
16
24
  logger.debug("Downloaded #{offset + results.count} of #{results.total}")
17
25
  write_rules_page(results.rules)
18
26
  offset += results.count
27
+ output[:rules_count] = results.total
19
28
  break if offset >= results.total
20
29
  end
21
30
  end
22
31
  end
23
32
 
24
33
  def logger
25
- Foreman::Logging.logger('background')
34
+ action_logger
26
35
  end
27
36
 
28
37
  private
@@ -43,12 +52,8 @@ module InsightsCloud
43
52
 
44
53
  def write_rules_page(rules)
45
54
  rules_attributes = rules.map { |rule| to_rule_hash(rule) }
46
- resolutions_attributes = rules.map do |rule|
47
- rule['resolution_set'].map { |resolution| to_resolution_hash(rule['rule_id'], resolution) }
48
- end.flatten
49
55
 
50
56
  InsightsRule.create(rules_attributes)
51
- InsightsResolution.create(resolutions_attributes)
52
57
  end
53
58
 
54
59
  def to_rule_hash(rule_hash)
@@ -66,15 +71,6 @@ module InsightsCloud
66
71
  rating: rule_hash['rating'],
67
72
  }
68
73
  end
69
-
70
- def to_resolution_hash(rule_id, resolution_hash)
71
- {
72
- rule_id: rule_id,
73
- system_type: resolution_hash['system_type'],
74
- resolution: resolution_hash['resolution'],
75
- has_playbook: resolution_hash['has_playbook'],
76
- }
77
- end
78
74
  end
79
75
  end
80
76
  end
@@ -10,7 +10,7 @@ module InsightsCloud
10
10
  return
11
11
  end
12
12
 
13
- InsightsFullSync.perform_later()
13
+ ForemanTasks.async_task InsightsFullSync
14
14
  ensure
15
15
  self.class.set(:wait => 24.hours).perform_later
16
16
  end
@@ -6,12 +6,13 @@ module InventorySync
6
6
  @count = result['count']
7
7
  @page = result['page']
8
8
  @per_page = result['per_page']
9
- @fqdns = result["results"].map { |host| host['fqdn'] }
9
+ @sub_ids = result["results"].map { |host| host['subscription_manager_id'] }
10
+ @uuid_by_sub_id = Hash[result["results"].map { |host| [host['subscription_manager_id'], host['id']] }]
10
11
  end
11
12
 
12
13
  def status_hashes
13
- @fqdns.map do |fqdn|
14
- host_id = host_id(fqdn)
14
+ @sub_ids.map do |sub_id|
15
+ host_id = host_id(sub_id)
15
16
  if host_id
16
17
  touched << host_id
17
18
  {
@@ -27,16 +28,20 @@ module InventorySync
27
28
  @touched ||= []
28
29
  end
29
30
 
30
- def host_id(fqdn)
31
- hosts[fqdn]
31
+ def host_id(sub_id)
32
+ hosts[sub_id]
32
33
  end
33
34
 
34
35
  def hosts
35
36
  @hosts ||= Hash[
36
- Host.where(name: @fqdns).pluck(:name, :id)
37
+ Katello::Host::SubscriptionFacet.where(uuid: @sub_ids).pluck(:uuid, :host_id)
37
38
  ]
38
39
  end
39
40
 
41
+ def host_uuids
42
+ @host_uuids ||= Hash[@sub_ids.map { |sub_id| [host_id(sub_id), @uuid_by_sub_id[sub_id]] }].except(nil)
43
+ end
44
+
40
45
  def percentage
41
46
  ratio = @per_page * @page * 1.0 / @total * 100
42
47
  ratio > 100 ? 100 : ratio.truncate(2)
@@ -1,42 +1,36 @@
1
- require 'rest-client'
2
-
3
1
  module InventorySync
4
2
  module Async
5
- class InventoryFullSync < ::ApplicationJob
6
- include ::ForemanRhCloud::CloudAuth
3
+ class InventoryFullSync < InventoryHostsSync
4
+ set_callback :iteration, :around, :setup_statuses
5
+ set_callback :step, :around, :update_statuses_batch
6
+
7
+ def plan(organization)
8
+ plan_self(organization_id: organization.id)
9
+ end
7
10
 
8
- def perform(organization)
9
- @organization = organization
11
+ def setup_statuses
10
12
  @subscribed_hosts_ids = Set.new(
11
13
  ForemanInventoryUpload::Generators::Queries.for_slice(
12
- Host.unscoped.where(organization: organization)
14
+ Host.unscoped.where(organization: input[:organization_id])
13
15
  ).pluck(:id)
14
16
  )
15
- @host_statuses = {
16
- sync: 0,
17
- disconnect: 0,
18
- }
19
17
 
20
18
  InventorySync::InventoryStatus.transaction do
21
19
  InventorySync::InventoryStatus.where(host_id: @subscribed_hosts_ids).delete_all
22
- page = 1
23
- loop do
24
- api_response = query_inventory(page)
25
- results = HostResult.new(api_response)
26
- logger.debug("Downloading cloud inventory data: #{results.percentage}%")
27
- update_hosts_status(results.status_hashes, results.touched)
28
- @host_statuses[:sync] += results.touched.size
29
- page += 1
30
- break if results.last?
31
- end
20
+ yield
32
21
  add_missing_hosts_statuses(@subscribed_hosts_ids)
33
- @host_statuses[:disconnect] += @subscribed_hosts_ids.size
22
+ host_statuses[:disconnect] += @subscribed_hosts_ids.size
34
23
  end
35
24
 
36
- logger.debug("Synced hosts amount: #{@host_statuses[:sync]}")
37
- logger.debug("Disconnected hosts amount: #{@host_statuses[:disconnect]}")
25
+ logger.debug("Synced hosts amount: #{host_statuses[:sync]}")
26
+ logger.debug("Disconnected hosts amount: #{host_statuses[:disconnect]}")
27
+ end
28
+
29
+ def update_statuses_batch
30
+ results = yield
38
31
 
39
- @host_statuses
32
+ update_hosts_status(results.status_hashes, results.touched)
33
+ host_statuses[:sync] += results.touched.size
40
34
  end
41
35
 
42
36
  private
@@ -58,22 +52,11 @@ module InventorySync
58
52
  )
59
53
  end
60
54
 
61
- def query_inventory(page = 1)
62
- hosts_inventory_response = RestClient::Request.execute(
63
- method: :get,
64
- url: ForemanInventoryUpload.inventory_export_url,
65
- verify_ssl: ForemanRhCloud.verify_ssl_method,
66
- proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
67
- headers: {
68
- Authorization: "Bearer #{rh_credentials}",
69
- params: {
70
- per_page: 100,
71
- page: page,
72
- },
73
- }
74
- )
75
-
76
- JSON.parse(hosts_inventory_response)
55
+ def host_statuses
56
+ output[:host_statuses] ||= {
57
+ sync: 0,
58
+ disconnect: 0,
59
+ }
77
60
  end
78
61
  end
79
62
  end
@@ -0,0 +1,34 @@
1
+ module InventorySync
2
+ module Async
3
+ class InventoryHostsSync < QueryInventoryJob
4
+ set_callback :iteration, :around, :setup_facet_transaction
5
+ set_callback :step, :around, :create_facets
6
+
7
+ def setup_facet_transaction
8
+ InsightsFacet.transaction do
9
+ yield
10
+ end
11
+ end
12
+
13
+ def create_facets
14
+ # get the results from the event
15
+ results = yield
16
+ add_missing_insights_facets(results.host_uuids)
17
+ results
18
+ end
19
+
20
+ private
21
+
22
+ def add_missing_insights_facets(uuids_hash)
23
+ existing_facets = InsightsFacet.where(host_id: uuids_hash.keys).pluck(:host_id)
24
+ missing_facets = uuids_hash.except(*existing_facets).map do |host_id, uuid|
25
+ {
26
+ host_id: host_id,
27
+ uuid: uuid,
28
+ }
29
+ end
30
+ InsightsFacet.create(missing_facets)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,17 @@
1
+ module InventorySync
2
+ module Async
3
+ class InventoryScheduledSync < ::Actions::EntryAction
4
+ include ::Actions::RecurringAction
5
+
6
+ def plan
7
+ Organization.unscoped.each do |org|
8
+ plan_org_sync(org)
9
+ end
10
+ end
11
+
12
+ def plan_org_sync(org)
13
+ plan_action InventoryFullSync, org
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,54 @@
1
+ require 'rest-client'
2
+
3
+ module InventorySync
4
+ module Async
5
+ class QueryInventoryJob < ::Actions::EntryAction
6
+ include ActiveSupport::Callbacks
7
+ include ::ForemanRhCloud::CloudAuth
8
+
9
+ define_callbacks :iteration, :step
10
+
11
+ def run
12
+ run_callbacks :iteration do
13
+ page = 1
14
+ loop do
15
+ api_response = query_inventory(page)
16
+ results = HostResult.new(api_response)
17
+ logger.debug("Downloaded cloud inventory data: #{results.percentage}%")
18
+
19
+ run_callbacks :step do
20
+ results
21
+ end
22
+
23
+ page += 1
24
+ break if results.last?
25
+ end
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def query_inventory(page = 1)
32
+ hosts_inventory_response = RestClient::Request.execute(
33
+ method: :get,
34
+ url: ForemanInventoryUpload.inventory_export_url,
35
+ verify_ssl: ForemanRhCloud.verify_ssl_method,
36
+ proxy: ForemanRhCloud.transformed_http_proxy_string(logger: logger),
37
+ headers: {
38
+ Authorization: "Bearer #{rh_credentials}",
39
+ params: {
40
+ per_page: 100,
41
+ page: page,
42
+ },
43
+ }
44
+ )
45
+
46
+ JSON.parse(hosts_inventory_response)
47
+ end
48
+
49
+ def logger
50
+ action_logger
51
+ end
52
+ end
53
+ end
54
+ end
@@ -1,15 +1,7 @@
1
1
  namespace :rh_cloud_insights do
2
- desc "Synchronize Insights inventory"
3
- task sync: :environment do
4
- if ! ENV['organization_id'].nil?
5
- organizations = [ Organization.where(:id => ENV['organization_id']).first ]
6
- else
7
- organizations = Organization.all
8
- end
9
-
10
- organizations.each do |organization|
11
- InventorySync::Async::InventoryFullSync.perform_now(organization)
12
- puts "Synchronized inventory for organization '#{organization.name}'"
13
- end
2
+ desc "Synchronize Insights hosts hits"
3
+ task sync: [:environment, 'dynflow:client'] do
4
+ ForemanTasks.sync_task(InsightsCloud::Async::InsightsFullSync)
5
+ puts "Synchronized Insights hosts hits data"
14
6
  end
15
7
  end
@@ -52,9 +52,17 @@ namespace :rh_cloud_inventory do
52
52
  end
53
53
  end
54
54
 
55
- desc "Synchronize Insights hosts hits"
56
- task sync: :environment do
57
- InsightsCloud::Async::InsightsFullSync.perform_now()
58
- puts "Synchronized Insights hosts hits data"
55
+ desc "Synchronize Hosts inventory"
56
+ task sync: [:environment, 'dynflow:client'] do
57
+ if ! ENV['organization_id'].nil?
58
+ organizations = [ Organization.where(:id => ENV['organization_id']).first ]
59
+ else
60
+ organizations = Organization.all
61
+ end
62
+
63
+ organizations.each do |organization|
64
+ ForemanTasks.async_task(InventorySync::Async::InventoryFullSync, organization)
65
+ puts "Synchronized inventory for organization '#{organization.name}'"
66
+ end
59
67
  end
60
68
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "3.0.18.1",
3
+ "version": "4.0.21.1",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,6 +19,28 @@ FactoryBot.define do
19
19
  sequence(:results_url) { |n| "https://cloud.redhat.com/insights/overview/stability/test_rule%7CTEST_RULE/accdf444-5628-451d-bf3e-cf909ad7275#{n}/" }
20
20
  rule_id { "test_rule|TEST_RULE" }
21
21
  end
22
+
23
+ factory :insights_rule do
24
+ sequence(:rule_id) { |n| "test_rule#{n}|TEST_RULE#{n}" }
25
+ description { 'test rule description' }
26
+ category_name { 'Testing' }
27
+ impact_name { 'Testing error' }
28
+ summary { 'Testing summary' }
29
+ generic { 'Testing generic' }
30
+ reason { 'No apparent reason' }
31
+ total_risk { -1 }
32
+ reboot_required { true }
33
+ more_info { 'more test info' }
34
+ rating { 0 }
35
+ end
36
+
37
+ factory :insights_resolution do
38
+ sequence(:rule_id) { |n| "test_rule#{n}|TEST_RULE#{n}" }
39
+ description { 'fix the issue on the fly' }
40
+ needs_reboot { false }
41
+ resolution_risk { 1 }
42
+ resolution_type { 'fix' }
43
+ end
22
44
  end
23
45
 
24
46
  FactoryBot.modify do