foreman_rh_cloud 3.0.17 → 3.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_inventory_upload/accounts_controller.rb +3 -15
  3. data/app/controllers/foreman_inventory_upload/uploads_controller.rb +0 -48
  4. data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +26 -0
  5. data/app/controllers/insights_cloud/hits_controller.rb +1 -1
  6. data/app/services/foreman_rh_cloud/branch_info.rb +3 -14
  7. data/app/services/foreman_rh_cloud/cloud_connector.rb +12 -7
  8. data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +31 -19
  9. data/config/routes.rb +2 -5
  10. data/db/migrate/20210307000001_add_unique_to_insights_facet.foreman_rh_cloud.rb +11 -0
  11. data/lib/foreman_inventory_upload.rb +2 -1
  12. data/lib/foreman_inventory_upload/generators/json_stream.rb +1 -1
  13. data/lib/foreman_inventory_upload/generators/slice.rb +14 -21
  14. data/lib/foreman_inventory_upload/generators/tags.rb +59 -0
  15. data/lib/foreman_rh_cloud.rb +4 -0
  16. data/lib/foreman_rh_cloud/version.rb +1 -1
  17. data/package.json +1 -1
  18. data/test/controllers/accounts_controller_test.rb +1 -5
  19. data/test/controllers/uploads_controller_test.rb +0 -13
  20. data/test/controllers/uploads_settings_controller_test.rb +31 -0
  21. data/test/test_plugin_helper.rb +13 -0
  22. data/test/unit/services/foreman_rh_cloud/branch_info_test.rb +5 -5
  23. data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +39 -4
  24. data/test/unit/slice_generator_test.rb +7 -2
  25. data/test/unit/tags_generator_test.rb +60 -0
  26. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.fixtures.js +4 -19
  27. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountList.js +7 -7
  28. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListHelper.js +6 -6
  29. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListReducer.js +0 -34
  30. data/webpack/ForemanInventoryUpload/Components/AccountList/AccountListSelectors.js +0 -14
  31. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyResults/emptyResults.scss +6 -4
  32. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/EmptyState/emptyState.scss +6 -4
  33. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ErrorState/errorState.scss +14 -12
  34. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.fixtures.js +10 -1
  35. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/ListItem.js +7 -7
  36. data/webpack/ForemanInventoryUpload/Components/AccountList/Components/ListItem/__tests__/__snapshots__/ListItem.test.js.snap +12 -9
  37. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListHelper.test.js +3 -3
  38. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListReducer.test.js +0 -30
  39. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/AccountListSelectors.test.js +1 -23
  40. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountList.test.js.snap +6 -6
  41. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListActions.test.js.snap +3 -8
  42. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListReducer.test.js.snap +3 -35
  43. data/webpack/ForemanInventoryUpload/Components/AccountList/__tests__/__snapshots__/AccountListSelectors.test.js.snap +6 -18
  44. data/webpack/ForemanInventoryUpload/Components/AccountList/accountList.scss +24 -22
  45. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.fixtures.js +1 -1
  46. data/webpack/ForemanInventoryUpload/Components/Dashboard/Dashboard.js +1 -1
  47. data/webpack/ForemanInventoryUpload/Components/FileDownload/FileDownload.js +2 -1
  48. data/webpack/ForemanInventoryUpload/Components/FileDownload/fileDownload.scss +4 -2
  49. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/FullScreenModal.js +2 -1
  50. data/webpack/ForemanInventoryUpload/Components/FullScreenModal/fullScreenModal.scss +16 -14
  51. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/Components/ClearButton/ClearButton.js +2 -1
  52. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.fixtures.js +1 -1
  53. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilter.js +2 -1
  54. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/InventoryFilterReducer.js +3 -11
  55. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilter.test.js +1 -1
  56. data/webpack/ForemanInventoryUpload/Components/InventoryFilter/__tests__/InventoryFilterReducer.test.js +3 -3
  57. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingActions.js +7 -0
  58. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/AdvancedSettingsConstants.js +26 -0
  59. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/__tests__/AdvancedSettingActions.test.js +9 -0
  60. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/__tests__/__snapshots__/AdvancedSettingActions.test.js.snap +18 -0
  61. data/webpack/ForemanInventoryUpload/Components/InventorySettings/AdvancedSetting/index.js +29 -0
  62. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.js +7 -8
  63. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettings.scss +15 -9
  64. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsActions.js +23 -0
  65. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsConstants.js +9 -0
  66. data/webpack/ForemanInventoryUpload/Components/InventorySettings/InventorySettingsSelectors.js +19 -0
  67. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/InventorySettingsActions.test.js +14 -0
  68. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettings.test.js.snap +16 -4
  69. data/webpack/ForemanInventoryUpload/Components/InventorySettings/__tests__/__snapshots__/InventorySettingsActions.test.js.snap +26 -0
  70. data/webpack/ForemanInventoryUpload/Components/InventorySettings/index.js +16 -1
  71. data/webpack/ForemanInventoryUpload/Components/NavContainer/NavContainer.fixtures.js +1 -1
  72. data/webpack/ForemanInventoryUpload/Components/NavContainer/navContainer.scss +7 -5
  73. data/webpack/ForemanInventoryUpload/Components/PageHeader/PageHeader.scss +1 -1
  74. data/webpack/ForemanInventoryUpload/Components/PageHeader/__tests__/__snapshots__/PageHeader.test.js.snap +1 -1
  75. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SettingsWarning/index.js +1 -1
  76. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/SyncButton.test.js +1 -1
  77. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/Modal.js +1 -1
  78. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/modal.scss +1 -1
  79. data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/index.js +1 -1
  80. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.fixtures.js +1 -1
  81. data/webpack/ForemanInventoryUpload/Components/ReportGenerate/ReportGenerate.js +1 -1
  82. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.fixtures.js +1 -1
  83. data/webpack/ForemanInventoryUpload/Components/ReportUpload/ReportUpload.js +1 -1
  84. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/index.js +1 -1
  85. data/webpack/ForemanInventoryUpload/Components/ScheduledRun/scheduledRun.scss +8 -6
  86. data/webpack/ForemanInventoryUpload/Components/StatusChart/statusChart.scss +9 -7
  87. data/webpack/ForemanInventoryUpload/Components/TabBody/tabBody.scss +4 -2
  88. data/webpack/ForemanInventoryUpload/Components/TabContainer/tabContainer.scss +7 -5
  89. data/webpack/ForemanInventoryUpload/Components/TabHeader/TabHeader.js +2 -1
  90. data/webpack/ForemanInventoryUpload/Components/TabHeader/tabHeader.scss +15 -13
  91. data/webpack/ForemanInventoryUpload/Components/Terminal/terminal.scss +27 -25
  92. data/webpack/ForemanInventoryUpload/ForemanInventoryUpload.js +1 -1
  93. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/InventoryAutoUpload.js +13 -8
  94. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/__tests__/InventoryAutoUpload.test.js +3 -3
  95. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/AdvancedSettings.js +21 -9
  96. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/components/AdvancedSettings/index.js +3 -8
  97. data/webpack/ForemanInventoryUpload/SubscriptionsPageExtension/InventoryAutoUpload/index.js +6 -4
  98. data/webpack/ForemanInventoryUpload/__tests__/__snapshots__/ForemanInventoryUpload.test.js.snap +1 -1
  99. data/webpack/InsightsCloudSync/Components/InsightsSettings/__tests__/InsightsSettings.test.js +1 -1
  100. data/webpack/InsightsCloudSync/Components/InsightsSyncSwitcher/__tests__/InsightsSyncSwitcher.test.js +1 -1
  101. data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/fixtures.js +1 -1
  102. data/webpack/InsightsCloudSync/InsightsCloudSync.test.js +1 -1
  103. data/webpack/InsightsHostDetailsTab/InsightsTab.js +2 -1
  104. data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +1 -1
  105. data/webpack/common/Switcher/SwitcherPF4.scss +1 -1
  106. metadata +55 -56
  107. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.fixtures.js +0 -3
  108. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcher.js +0 -29
  109. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherActions.js +0 -29
  110. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/AutoUploadSwitcherConstants.js +0 -1
  111. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcher.test.js +0 -14
  112. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/AutoUploadSwitcherActions.test.js +0 -24
  113. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcher.test.js.snap +0 -15
  114. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/__tests__/__snapshots__/AutoUploadSwitcherActions.test.js.snap +0 -31
  115. data/webpack/ForemanInventoryUpload/Components/AutoUploadSwitcher/index.js +0 -17
  116. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.fixtures.js +0 -1
  117. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcher.js +0 -27
  118. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherActions.js +0 -29
  119. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/ExcludePackagesSwitcherConstants.js +0 -1
  120. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcher.test.js +0 -13
  121. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/ExcludePackagesSwitcherActions.test.js +0 -21
  122. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcher.test.js.snap +0 -15
  123. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/ExcludePackagesSwitcherActions.test.js.snap +0 -31
  124. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/__snapshots__/integration.test.js.snap +0 -46
  125. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js +0 -36
  126. data/webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/index.js +0 -20
  127. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.fixtures.js +0 -2
  128. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcher.js +0 -27
  129. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherActions.js +0 -29
  130. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/HostObfuscationSwitcherConstants.js +0 -1
  131. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcher.test.js +0 -14
  132. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/HostObfuscationSwitcherActions.test.js +0 -24
  133. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcher.test.js.snap +0 -15
  134. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/__tests__/__snapshots__/HostObfuscationSwitcherActions.test.js.snap +0 -31
  135. data/webpack/ForemanInventoryUpload/Components/HostObfuscationSwitcher/index.js +0 -20
  136. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.fixtures.js +0 -1
  137. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcher.js +0 -27
  138. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherActions.js +0 -29
  139. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/IpsObfuscationSwitcherConstants.js +0 -1
  140. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcher.test.js +0 -13
  141. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/IpsObfuscationSwitcherActions.test.js +0 -21
  142. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcher.test.js.snap +0 -15
  143. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/__tests__/__snapshots__/IpsObfuscationSwitcherActions.test.js.snap +0 -31
  144. data/webpack/ForemanInventoryUpload/Components/IpsObfuscationSwitcher/index.js +0 -20
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '3.0.17'.freeze
2
+ VERSION = '3.0.18'.freeze
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "3.0.17",
3
+ "version": "3.0.18",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,17 +14,13 @@ class AccountsControllerTest < ActionController::TestCase
14
14
  upload_label = ForemanInventoryUpload::Async::UploadReportJob.output_label(test_org.id)
15
15
  upload_output = ForemanInventoryUpload::Async::ProgressOutput.register(upload_label)
16
16
  upload_output.status = 'upload_status_test'
17
- FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :value => true)
18
- assert_equal true, Setting[:allow_auto_inventory_upload]
19
17
 
20
18
  get :index, session: set_session_user
21
19
 
22
20
  assert_response :success
23
21
  actual = JSON.parse(response.body)
24
- actual_account_statuses = actual['accounts'][test_org.id.to_s]
22
+ actual_account_statuses = actual['accounts'][test_org.label]
25
23
  assert_equal 'generate_status_test', actual_account_statuses['generate_report_status']
26
24
  assert_equal 'upload_status_test', actual_account_statuses['upload_report_status']
27
-
28
- assert_equal true, actual['autoUploadEnabled']
29
25
  end
30
26
  end
@@ -18,17 +18,4 @@ class UploadsControllerTest < ActionController::TestCase
18
18
  actual = JSON.parse(response.body)
19
19
  assert_equal 'test output', actual['output']
20
20
  end
21
-
22
- test 'should update allow_auto_inventory_upload setting' do
23
- FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => false)
24
-
25
- assert_equal false, Setting[:allow_auto_inventory_upload]
26
-
27
- post :auto_upload, params: { value: true }, session: set_session_user
28
-
29
- assert_response :success
30
- actual = JSON.parse(response.body)
31
- assert_equal true, actual['autoUploadEnabled']
32
- assert_equal true, Setting[:allow_auto_inventory_upload]
33
- end
34
21
  end
@@ -0,0 +1,31 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class UploadsSettingsControllerTest < ActionController::TestCase
4
+ tests ForemanInventoryUpload::UploadsSettingsController
5
+
6
+ test 'should get upload inventory settings' do
7
+ FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => true)
8
+
9
+ assert_equal true, Setting[:allow_auto_inventory_upload]
10
+
11
+ get :index, session: set_session_user
12
+
13
+ assert_response :success
14
+ actual = JSON.parse(response.body)
15
+ assert_equal true, actual['autoUploadEnabled']
16
+ assert_equal true, Setting[:allow_auto_inventory_upload]
17
+ end
18
+
19
+ test 'should update allow_auto_inventory_upload setting' do
20
+ FactoryBot.create(:setting, :name => 'allow_auto_inventory_upload', :settings_type => "boolean", :category => "Setting::RhCloud", :default => false, :value => false)
21
+
22
+ assert_equal false, Setting[:allow_auto_inventory_upload]
23
+
24
+ post :set_advanced_setting, params: { setting: :allow_auto_inventory_upload, value: true }, session: set_session_user
25
+
26
+ assert_response :success
27
+ actual = JSON.parse(response.body)
28
+ assert_equal true, actual['autoUploadEnabled']
29
+ assert_equal true, Setting[:allow_auto_inventory_upload]
30
+ end
31
+ end
@@ -24,3 +24,16 @@ module FolderIsolation
24
24
  end
25
25
  end
26
26
  end
27
+
28
+ module KatelloLocationFix
29
+ extend ActiveSupport::Concern
30
+
31
+ included do
32
+ setup do
33
+ FactoryBot.create(:setting, name: 'default_location_subscribed_hosts')
34
+ FactoryBot.create(:setting, name: 'default_location_puppet_content')
35
+ Setting[:default_location_subscribed_hosts] = Location.first.title
36
+ Setting[:default_location_puppet_content] = Location.first.title
37
+ end
38
+ end
39
+ end
@@ -46,15 +46,15 @@ class BranchInfoTest < ActiveSupport::TestCase
46
46
 
47
47
  labels = ::ForemanRhCloud::BranchInfo.new.generate('a1', @host, 'branch', 'foo')[:labels]
48
48
 
49
- org_label = labels.find { |label| label[:key] == 'Organization' }
50
- loc_label = labels.find { |label| label[:key] == 'Location' }
49
+ org_label = labels.find { |label| label[:key] == 'organization' }
50
+ loc_label = labels.find { |label| label[:key] == 'location' }
51
51
  assert_equal @host.organization.title, org_label[:value]
52
52
  assert_equal @host.location.title, loc_label[:value]
53
53
 
54
- hg_label = labels.find { |label| label[:key] == 'Host Group' }
55
- host_colections = labels.select { |label| label[:key] == 'Host Collection' }
54
+ hg_label = labels.find { |label| label[:key] == 'hostgroup' }
55
+ host_colections = labels.select { |label| label[:key] == 'host collection' }
56
56
  assert_equal @host.hostgroup.name, hg_label[:value]
57
57
  assert_equal 2, host_colections.count
58
- refute_empty labels.select { |label| label[:namespace] == 'SatelliteParameter' }
58
+ refute_empty labels.select { |label| label[:namespace] == 'satellite_parameter' }
59
59
  end
60
60
  end
@@ -4,20 +4,55 @@ require 'puma/null_io'
4
4
  class CloudRequestForwarderTest < ActiveSupport::TestCase
5
5
  setup do
6
6
  @forwarder = ::ForemanRhCloud::CloudRequestForwarder.new
7
+
8
+ @cert1 = "-----BEGIN CERTIFICATE-----\r\n" +
9
+ "MIIFdDCCA1ygAwIBAgIJAM5Uqykb3EAtMA0GCSqGSIb3DQEBCwUAME8xCzAJBgNV\r\n" +
10
+ "BAYTAklMMREwDwYDVQQIDAhUZWwgQXZpdjEUMBIGA1UECgwLVGhlIEZvcmVtYW4x\r\n" +
11
+ "FzAVBgNVBAMMDnRoZWZvcmVtYW4ub3JnMB4XDTE4MDMyNDEyMzYyOFoXDTI4MDMy\r\n" +
12
+ "MTEyMzYyOFowTzELMAkGA1UEBhMCSUwxETAPBgNVBAgMCFRlbCBBdml2MRQwEgYD\r\n" +
13
+ "VQQKDAtUaGUgRm9yZW1hbjEXMBUGA1UEAwwOdGhlZm9yZW1hbi5vcmcwggIiMA0G\r\n" +
14
+ "CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDF04/s4h+BgHPG1HDZ/sDlYq925pkc\r\n" +
15
+ "RTVAfnE2EXDAmZ6W4Q9ueDY65MHe3ZWO5Dg72kNSP2sK9kRI7Dk5CAFOgyw1rH8t\r\n" +
16
+ "Hd1+0xp/lv6e4SvSYghxIL68vFe0ftKkm1usqejBM5ZTgKr7JCI+XSIN36F65Kde\r\n" +
17
+ "c+vxwBnayuhP04r9/aaE/709SXML4eRVYW8I3qFy9FPtUOm+bY8U2PIv5fHayqbG\r\n" +
18
+ "cL/4t3+MCtMhHJsLzdBXya+1P5t+HcKjUNlmwoUF961YAktVuEFloGd0RMRlqF3/\r\n" +
19
+ "itU3QNlXgA5QBIciE5VPr/PiqgMC3zgd5avjF4OribZ+N9AATLiQMW78il5wSfcc\r\n" +
20
+ "kQjU9ChOLrzku455vQ8KE4bc0qvpCWGfUah6MvL9JB+TQkRl/8kxl0b9ZinIvJDH\r\n" +
21
+ "ynVMb4cB/TDEjrjOfzn9mWLH0ZJqjmc2bER/G12WQxOaYLxdVwRStD3Yh6PtiFWu\r\n" +
22
+ "sXOk19UOTVkeuvGFVtvzLfEwQ1lDEo7+VBQz8FG/HBu2Hpq3IwCFrHuicikwjQJk\r\n" +
23
+ "nfturgD0rBOKEc1qWNZRCvovYOLL6ihvv5Orujsx5ZCHOAtnVNxkvIlFt2RS45LF\r\n" +
24
+ "MtPJyhAc6SjitllfUEirxprsbmeSZqrIfzcGaEhgOSnyik1WMv6bYiqPfBg8Fzjh\r\n" +
25
+ "vOCbtiDNPmvgOwIDAQABo1MwUTAdBgNVHQ4EFgQUtkAgQopsTtG9zSG3MgW2IxHD\r\n" +
26
+ "MDwwHwYDVR0jBBgwFoAUtkAgQopsTtG9zSG3MgW2IxHDMDwwDwYDVR0TAQH/BAUw\r\n" +
27
+ "AwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAJq7iN+ZroRBweNhvUobxs75bLIV6tNn1\r\n" +
28
+ "MdNHDRA+hezwf+gxHZhFyaAHfTpst2/9leK5Qe5Zd6gZLr3E5/8ppQuRod72H39B\r\n" +
29
+ "vxMlG5zxDss0WMo3vZeKZbTY6QhXi/lY2IZ6OGV4feSvCsYxn27GTjjrRUSLFeHH\r\n" +
30
+ "JVemCwCDMavaE3+OIY4v2P4FcG+MjUvfOB9ahI24TWL7YgrsNVmJjCILq+EeUj0t\r\n" +
31
+ "Gde1SXVyLkqt7PoxHRJAE0BCEMJSnjxaVB329acJgeehBUxjj4CCPqtDxtbz9HEH\r\n" +
32
+ "mOKfNdaKpFor+DUeEKUWVGnr9U9xOaC+Ws+oX7MIEUCDM7p2ob4JwcjnFs1jZgHh\r\n" +
33
+ "Hwig+i7doTlc701PvKWO96fuNHK3B3/jTb1fVvSZ49O/RvY1VWODdUdxWmXGHNh3\r\n" +
34
+ "LoR8tSPEb46lC2DXGaIQumqQt8PnBG+vL1qkQa1SGTV7dJ8TTbxbv0S+sS+igkk9\r\n" +
35
+ "zsIEK8Ea3Ep935cXximz0faAAKHSA+It+xHLAyDtqy2KaAEBgGsBuuWlUfK6TaP3\r\n" +
36
+ "Gwdjct3y4yYUO45lUsUfHqX8vk/4ttW5zYeDiW+HArJz+9VUXNbEdury4kGuHgBj\r\n" +
37
+ "xHD4Bsul65+hHZ9QywKU26F1A6TLkYpQ2rk/Dx9LGICM4m4IlHjWJPFsQdtkyOor\r\n" +
38
+ "osxMtcaZZ1E=\r\n" +
39
+ "-----END CERTIFICATE-----"
7
40
  end
8
41
 
9
42
  test 'should prepare correct cloud url' do
10
43
  paths = {
11
- "/redhat_access/r/insights/platform/module-update-router/v1/channel?module=insights-core" => "https://cloud.redhat.com/api/module-update-router/v1/channel?module=insights-core",
44
+ "/redhat_access/r/insights/platform/module-update-router/v1/channel?module=insights-core" => "https://cert.cloud.redhat.com/api/module-update-router/v1/channel?module=insights-core",
12
45
  "/redhat_access/r/insights/v1/static/release/insights-core.egg" => "https://cloud.redhat.com/api/v1/static/release/insights-core.egg",
13
46
  "/redhat_access/r/insights/v1/static/uploader.v2.json" => "https://cloud.redhat.com/api/v1/static/uploader.v2.json",
14
47
  "/redhat_access/r/insights/v1/static/uploader.v2.json.asc" => "https://cloud.redhat.com/api/v1/static/uploader.v2.json.asc",
15
- "/redhat_access/r/insights/platform/inventory/v1/hosts" => "https://cloud.redhat.com/api/inventory/v1/hosts",
16
- "/redhat_access/r/insights/platform/ingress/v1/upload" => "https://cloud.redhat.com/api/ingress/v1/upload",
48
+ "/redhat_access/r/insights/platform/inventory/v1/hosts" => "https://cert.cloud.redhat.com/api/inventory/v1/hosts",
49
+ "/redhat_access/r/insights/platform/ingress/v1/upload" => "https://cert.cloud.redhat.com/api/ingress/v1/upload",
50
+ "/redhat_access/r/insights/uploads/67200803-132b-474b-a6f9-37be74185df4" => "https://cert-api.access.redhat.com/r/insights/uploads/67200803-132b-474b-a6f9-37be74185df4",
17
51
  }
18
52
 
19
53
  paths.each do |key, value|
20
- assert_equal value, @forwarder.prepare_forward_cloud_url(ForemanRhCloud.base_url, key)
54
+ actual_params = @forwarder.path_params(key, { cert: @cert1, key: OpenSSL::PKey::RSA.new(1024).to_pem })
55
+ assert_equal value, actual_params[:url]
21
56
  end
22
57
  end
23
58
 
@@ -1,12 +1,16 @@
1
1
  require 'test_plugin_helper'
2
2
 
3
3
  class SliceGeneratorTest < ActiveSupport::TestCase
4
+ include KatelloLocationFix
5
+
4
6
  setup do
5
7
  User.current = User.find_by(login: 'secret_admin')
6
8
 
7
9
  env = FactoryBot.create(:katello_k_t_environment)
8
10
  cv = env.content_views << FactoryBot.create(:katello_content_view, organization: env.organization)
9
11
 
12
+ location = FactoryBot.create(:location)
13
+
10
14
  @host = FactoryBot.create(
11
15
  :host,
12
16
  :redhat,
@@ -14,7 +18,8 @@ class SliceGeneratorTest < ActiveSupport::TestCase
14
18
  :with_content,
15
19
  content_view: cv.first,
16
20
  lifecycle_environment: env,
17
- organization: env.organization
21
+ organization: env.organization,
22
+ location: location
18
23
  )
19
24
 
20
25
  @host.organization.pools << FactoryBot.create(:katello_pool, account_number: '1234', cp_id: 1)
@@ -287,7 +292,7 @@ class SliceGeneratorTest < ActiveSupport::TestCase
287
292
  end
288
293
 
289
294
  test 'generates a report with satellite facts' do
290
- hostgroup = FactoryBot.create(:hostgroup)
295
+ hostgroup = FactoryBot.create(:hostgroup, name: 'Special"name')
291
296
  @host.hostgroup = hostgroup
292
297
  @host.save!
293
298
 
@@ -0,0 +1,60 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class TagsGeneratorTest < ActiveSupport::TestCase
4
+ include KatelloLocationFix
5
+
6
+ setup do
7
+ User.current = User.find_by(login: 'secret_admin')
8
+
9
+ env = FactoryBot.create(:katello_k_t_environment)
10
+ cv = env.content_views << FactoryBot.create(:katello_content_view, organization: env.organization)
11
+
12
+ @location1 = FactoryBot.create(:location)
13
+ @location2 = FactoryBot.create(:location, parent: @location1)
14
+
15
+ @hostgroup1 = FactoryBot.create(:hostgroup)
16
+ @hostgroup2 = FactoryBot.create(:hostgroup, parent: @hostgroup1)
17
+
18
+ @host = FactoryBot.create(
19
+ :host,
20
+ :redhat,
21
+ :with_subscription,
22
+ :with_content,
23
+ content_view: cv.first,
24
+ lifecycle_environment: env,
25
+ organization: env.organization,
26
+ location: @location2,
27
+ hostgroup: @hostgroup2
28
+ )
29
+
30
+ @host.organization.pools << FactoryBot.create(:katello_pool, account_number: '1234', cp_id: 1)
31
+ @host.interfaces.first.identifier = 'test_nic1'
32
+ @host.save!
33
+ end
34
+
35
+ test 'generates tags for a single host' do
36
+ generator = create_generator
37
+
38
+ actual = generator.generate.group_by { |key, value| key }
39
+
40
+ locations = actual['location']
41
+ assert_equal 3, locations.length
42
+
43
+ hostgroups = actual['hostgroup']
44
+ assert_equal 3, hostgroups.length
45
+
46
+ assert_nil actual['host collection']
47
+
48
+ assert_equal @host.organization.name, actual['organization'].first.last
49
+ assert_equal @host.lifecycle_environment.name, actual['lifecycle_environment'].first.last
50
+ assert_equal @host.content_view.name, actual['content_view'].first.last
51
+ assert_equal Foreman.instance_id, actual['satellite_instance_id'].first.last
52
+ assert_equal @host.organization_id.to_s, actual['organization_id'].first.last
53
+ end
54
+
55
+ private
56
+
57
+ def create_generator
58
+ ForemanInventoryUpload::Generators::Tags.new(@host)
59
+ end
60
+ end
@@ -1,18 +1,18 @@
1
- import { noop } from 'patternfly-react';
1
+ import { noop } from 'foremanReact/common/helpers';
2
2
 
3
3
  export const accounts = {
4
4
  Account1: {
5
- label: 'test_org1',
5
+ id: 1,
6
6
  upload_report_status: 'running',
7
7
  generate_report_status: 'running',
8
8
  },
9
9
  Account2: {
10
- label: 'test_org2',
10
+ id: 2,
11
11
  upload_report_status: 'unknown',
12
12
  generate_report_status: 'failure',
13
13
  },
14
14
  Account3: {
15
- label: 'test_org3',
15
+ id: 3,
16
16
  upload_report_status: 'success',
17
17
  generate_report_status: 'running',
18
18
  },
@@ -30,18 +30,8 @@ export const accountID = 'user@redhat.com';
30
30
 
31
31
  export const processStatusName = 'upload_report_status';
32
32
 
33
- export const autoUploadEnabled = true;
34
-
35
- export const hostObfuscationEnabled = true;
36
-
37
- export const ipsObfuscationEnabled = true;
38
-
39
33
  export const filterTerm = 'some_filter';
40
34
 
41
- export const cloudToken = true;
42
-
43
- export const excludePackages = false;
44
-
45
35
  export const CloudConnectorStatus = {
46
36
  id: 7,
47
37
  task: { id: 11 },
@@ -57,11 +47,6 @@ export const props = {
57
47
 
58
48
  export const pollingResponse = {
59
49
  accounts,
60
- autoUploadEnabled,
61
- hostObfuscationEnabled,
62
- ipsObfuscationEnabled,
63
- cloudToken,
64
- excludePackages,
65
50
  CloudConnectorStatus,
66
51
  };
67
52
 
@@ -1,4 +1,5 @@
1
1
  import React, { Component } from 'react';
2
+ import { isEmpty } from 'lodash';
2
3
  import { noop } from 'foremanReact/common/helpers';
3
4
  import { Accordion } from '@patternfly/react-core';
4
5
  import PropTypes from 'prop-types';
@@ -24,24 +25,23 @@ class AccountList extends Component {
24
25
 
25
26
  render() {
26
27
  const { accounts, error, filterTerm } = this.props;
27
- const accountIds = Object.keys(accounts);
28
- const filteredAccountIds = filterAccounts(accounts, accountIds, filterTerm);
28
+ const filteredAccount = filterAccounts(accounts, filterTerm);
29
29
 
30
30
  if (error) {
31
31
  return <ErrorState error={error} />;
32
32
  }
33
33
 
34
- if (accountIds.length === 0) {
34
+ if (isEmpty(accounts)) {
35
35
  return <EmptyState />;
36
36
  }
37
37
 
38
- if (filteredAccountIds.length === 0) {
38
+ if (isEmpty(filteredAccount)) {
39
39
  return <EmptyResults />;
40
40
  }
41
41
 
42
- const items = filteredAccountIds.map((accountID, index) => {
43
- const account = accounts[accountID];
44
- return <ListItem key={index} accountID={accountID} account={account} />;
42
+ const items = Object.keys(filteredAccount).map((label, index) => {
43
+ const account = accounts[label];
44
+ return <ListItem key={index} label={label} account={account} />;
45
45
  });
46
46
  return <Accordion className="account-list">{items}</Accordion>;
47
47
  }
@@ -1,10 +1,10 @@
1
- export const filterAccounts = (accounts, accountIds, filterTerm) => {
2
- if (!filterTerm || !accountIds.length) {
3
- return accountIds;
4
- }
1
+ import { pickBy } from 'lodash';
2
+
3
+ export const filterAccounts = (accounts, filterTerm) => {
4
+ if (!filterTerm) return accounts;
5
5
 
6
6
  const filterTermLowerCased = filterTerm.toLowerCase();
7
- return accountIds.filter(id =>
8
- accounts[id].label.toLowerCase().includes(filterTermLowerCased)
7
+ return pickBy(accounts, (value, key) =>
8
+ key.toLowerCase().includes(filterTermLowerCased)
9
9
  );
10
10
  };
@@ -1,8 +1,4 @@
1
1
  import Immutable from 'seamless-immutable';
2
- import { AUTO_UPLOAD_TOGGLE } from '../AutoUploadSwitcher/AutoUploadSwitcherConstants';
3
- import { HOST_OBFUSCATION_TOGGLE } from '../HostObfuscationSwitcher/HostObfuscationSwitcherConstants';
4
- import { IPS_OBFUSCATION_TOGGLE } from '../IpsObfuscationSwitcher/IpsObfuscationSwitcherConstants';
5
- import { EXCLUDE_PACKAGES_TOGGLE } from '../ExcludePackagesSwitcher/ExcludePackagesSwitcherConstants';
6
2
  import {
7
3
  INVENTORY_ACCOUNT_STATUS_POLLING,
8
4
  INVENTORY_ACCOUNT_STATUS_POLLING_ERROR,
@@ -24,11 +20,6 @@ export default (state = initialState, action) => {
24
20
  accounts,
25
21
  accountID,
26
22
  processStatusName,
27
- autoUploadEnabled,
28
- hostObfuscationEnabled,
29
- ipsObfuscationEnabled,
30
- cloudToken,
31
- excludePackages,
32
23
  CloudConnectorStatus,
33
24
  } = {},
34
25
  } = action;
@@ -38,11 +29,6 @@ export default (state = initialState, action) => {
38
29
  return state.merge({
39
30
  ...state,
40
31
  accounts,
41
- autoUploadEnabled,
42
- hostObfuscationEnabled,
43
- ipsObfuscationEnabled,
44
- cloudToken,
45
- excludePackages,
46
32
  CloudConnectorStatus,
47
33
  error: null,
48
34
  });
@@ -65,26 +51,6 @@ export default (state = initialState, action) => {
65
51
  [processStatusName]: 'Restarting...',
66
52
  },
67
53
  });
68
- case AUTO_UPLOAD_TOGGLE:
69
- return state.merge({
70
- ...state,
71
- autoUploadEnabled,
72
- });
73
- case HOST_OBFUSCATION_TOGGLE:
74
- return state.merge({
75
- ...state,
76
- hostObfuscationEnabled,
77
- });
78
- case EXCLUDE_PACKAGES_TOGGLE:
79
- return state.merge({
80
- ...state,
81
- excludePackages,
82
- });
83
- case IPS_OBFUSCATION_TOGGLE:
84
- return state.merge({
85
- ...state,
86
- ipsObfuscationEnabled,
87
- });
88
54
  default:
89
55
  return state;
90
56
  }