katello 3.18.5 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/katello/katello.scss +72 -0
  3. data/app/controllers/katello/api/registry/registry_proxies_controller.rb +6 -4
  4. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +0 -19
  5. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -3
  6. data/app/controllers/katello/api/v2/content_credentials_controller.rb +24 -24
  7. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/content_exports_controller.rb +4 -0
  9. data/app/controllers/katello/api/v2/content_views_controller.rb +2 -2
  10. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -3
  11. data/app/controllers/katello/api/v2/repositories_controller.rb +3 -19
  12. data/app/controllers/katello/api/v2/simple_content_access_controller.rb +34 -0
  13. data/app/controllers/katello/api/v2/subscriptions_controller.rb +1 -1
  14. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +8 -4
  15. data/app/controllers/katello/concerns/api/v2/authorization.rb +1 -14
  16. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +1 -1
  17. data/app/helpers/katello/sync_management_helper.rb +0 -2
  18. data/app/lib/actions/candlepin/environment/create.rb +1 -1
  19. data/app/lib/actions/candlepin/environment/set_content.rb +1 -1
  20. data/app/lib/actions/katello/activation_key/create.rb +9 -11
  21. data/app/lib/actions/katello/capsule_content/sync.rb +8 -8
  22. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +9 -0
  23. data/app/lib/actions/katello/check_matching_content.rb +17 -0
  24. data/app/lib/actions/katello/content_view/environment_create.rb +6 -8
  25. data/app/lib/actions/katello/content_view/publish.rb +1 -1
  26. data/app/lib/actions/katello/content_view_version/incremental_update.rb +11 -7
  27. data/app/lib/actions/katello/host/hypervisors_update.rb +4 -4
  28. data/app/lib/actions/katello/organization/create.rb +3 -5
  29. data/app/lib/actions/katello/organization/destroy.rb +1 -1
  30. data/app/lib/actions/katello/organization/manifest_delete.rb +3 -5
  31. data/app/lib/actions/katello/organization/manifest_import.rb +1 -1
  32. data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -1
  33. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +1 -1
  34. data/app/lib/actions/katello/repository/check_matching_content.rb +3 -1
  35. data/app/lib/actions/katello/repository/clone_contents.rb +8 -11
  36. data/app/lib/actions/katello/repository/create.rb +0 -8
  37. data/app/lib/actions/katello/repository/filtered_index_content.rb +3 -0
  38. data/app/lib/actions/katello/repository/index_content.rb +1 -0
  39. data/app/lib/actions/katello/repository/multi_clone_contents.rb +9 -12
  40. data/app/lib/actions/katello/repository/sync.rb +1 -5
  41. data/app/lib/actions/katello/repository/update.rb +0 -8
  42. data/app/lib/actions/middleware/execute_if_contents_changed.rb +4 -1
  43. data/app/lib/actions/pulp/orchestration/repository/refresh_repos.rb +0 -6
  44. data/app/lib/actions/pulp3/capsule_content/refresh_distribution.rb +3 -3
  45. data/app/lib/actions/pulp3/content_guard/refresh_all_distributions.rb +1 -2
  46. data/app/lib/actions/pulp3/content_migration_presenter.rb +2 -5
  47. data/app/lib/actions/pulp3/orchestration/repository/refresh_repos.rb +1 -6
  48. data/app/lib/katello/concerns/base_template_scope_extensions.rb +8 -0
  49. data/app/lib/katello/errors.rb +1 -1
  50. data/app/lib/katello/event_daemon/monitor.rb +53 -0
  51. data/app/lib/katello/event_daemon/runner.rb +99 -0
  52. data/app/lib/katello/logging.rb +32 -0
  53. data/app/lib/katello/messaging/connection.rb +1 -7
  54. data/app/lib/katello/util/pulpcore_content_filters.rb +1 -1
  55. data/app/lib/katello/validators/content_view_puppet_module_validator.rb +1 -1
  56. data/app/models/katello/activation_key.rb +2 -2
  57. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  58. data/app/models/katello/concerns/hostgroup_extensions.rb +2 -4
  59. data/app/models/katello/concerns/organization_extensions.rb +2 -2
  60. data/app/models/katello/concerns/pulp_database_unit.rb +0 -12
  61. data/app/models/katello/concerns/redhat_extensions.rb +8 -9
  62. data/app/models/katello/concerns/smart_proxy_extensions.rb +24 -0
  63. data/app/models/katello/content_view.rb +5 -1
  64. data/app/models/katello/content_view_environment.rb +2 -2
  65. data/app/models/katello/content_view_puppet_environment.rb +2 -2
  66. data/app/models/katello/content_view_version.rb +2 -1
  67. data/app/models/katello/content_view_version_export_history.rb +20 -0
  68. data/app/models/katello/erratum.rb +3 -1
  69. data/app/models/katello/file_unit.rb +0 -4
  70. data/app/models/katello/glue/candlepin/pool.rb +2 -0
  71. data/app/models/katello/glue/pulp/repo.rb +0 -6
  72. data/app/models/katello/glue/pulp/repos.rb +1 -22
  73. data/app/models/katello/host/content_facet.rb +31 -9
  74. data/app/models/katello/ping.rb +19 -39
  75. data/app/models/katello/pool.rb +5 -0
  76. data/app/models/katello/product.rb +3 -3
  77. data/app/models/katello/repository.rb +3 -3
  78. data/app/presenters/katello/host_subscription_presenter.rb +3 -4
  79. data/app/presenters/katello/host_subscriptions_presenter.rb +24 -0
  80. data/app/services/katello/applicability/applicable_content_helper.rb +6 -8
  81. data/app/services/katello/candlepin_event_listener.rb +11 -19
  82. data/app/services/katello/event_monitor/poller_thread.rb +2 -11
  83. data/app/services/katello/pulp/repository.rb +2 -4
  84. data/app/services/katello/pulp/smart_proxy_repository.rb +0 -15
  85. data/app/services/katello/pulp3/api/core.rb +0 -14
  86. data/app/services/katello/pulp3/erratum.rb +1 -2
  87. data/app/services/katello/pulp3/migration.rb +9 -83
  88. data/app/services/katello/pulp3/migration_plan.rb +5 -54
  89. data/app/services/katello/pulp3/migration_switchover.rb +5 -36
  90. data/app/services/katello/pulp3/repository/apt.rb +2 -1
  91. data/app/services/katello/pulp3/repository/yum.rb +2 -11
  92. data/app/services/katello/pulp3/repository.rb +13 -34
  93. data/app/services/katello/pulp3/rpm.rb +1 -5
  94. data/app/services/katello/pulp3/task.rb +5 -8
  95. data/app/services/katello/pulp3/task_group.rb +5 -13
  96. data/app/services/katello/repository_type.rb +1 -1
  97. data/app/views/foreman/smart_proxies/_content_tab.html.erb +4 -47
  98. data/app/views/foreman/smart_proxies/show.html.erb +1 -1
  99. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +22 -25
  100. data/app/views/katello/api/v2/content_view_version_export_histories/show.json.rabl +1 -0
  101. data/app/views/katello/api/v2/organizations/show.json.rabl +7 -9
  102. data/app/views/katello/sync_management/_products.html.erb +1 -1
  103. data/app/views/overrides/organizations/_edit_override.html.erb +1 -4
  104. data/app/views/overrides/smart_proxies/_environment_tab.html.erb +1 -1
  105. data/app/views/overrides/smart_proxies/_environment_tab_pane.html.erb +1 -1
  106. data/config/katello.yaml.example +0 -3
  107. data/config/routes/api/v2.rb +8 -10
  108. data/db/migrate/20191204214919_add_content_view_version_counts.rb +0 -1
  109. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +1 -1
  110. data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +56 -0
  111. data/db/migrate/20210128231228_add_type_and_from_cvv_to_cvv_export_history.rb +14 -0
  112. data/db/migrate/20210201163238_migrate_background_download_policy_to_migrate.rb +7 -0
  113. data/db/seeds.d/104-proxy.rb +1 -1
  114. data/db/seeds.d/111-upgrade_tasks.rb +2 -1
  115. data/engines/bastion/app/assets/javascripts/bastion/auth/authorization.service.js +1 -1
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +1 -1
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-register-os-client.directive.js +17 -0
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +2 -2
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-client.html +11 -4
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-deb-client.html +38 -0
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-oracle-client.html +5 -0
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register-sles-client.html +28 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/register.html +14 -11
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +2 -2
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +2 -2
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +1 -1
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/download-policy.service.js +0 -1
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +1 -1
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +2 -2
  131. data/lib/katello/engine.rb +4 -5
  132. data/lib/katello/middleware/event_daemon.rb +1 -1
  133. data/lib/katello/permission_creator.rb +3 -2
  134. data/lib/katello/plugin.rb +2 -2
  135. data/lib/katello/tasks/jenkins.rake +1 -1
  136. data/lib/katello/tasks/pulp3_content_switchover.rake +20 -31
  137. data/lib/katello/tasks/pulp3_migration.rake +25 -45
  138. data/lib/katello/tasks/pulp3_migration_abort.rake +0 -8
  139. data/lib/katello/tasks/pulp3_migration_stats.rake +3 -46
  140. data/lib/katello/tasks/upgrades/4.0/remove_ostree_puppet_content.rake +16 -0
  141. data/lib/katello/version.rb +1 -1
  142. data/lib/proxy_api/container_gateway.rb +21 -0
  143. data/locale/bn/katello.edit.po +0 -0
  144. data/locale/cs/katello.edit.po +0 -0
  145. data/locale/de/katello.edit.po +0 -0
  146. data/locale/en/katello.edit.po +0 -0
  147. data/locale/es/katello.edit.po +0 -0
  148. data/locale/fr/katello.edit.po +0 -0
  149. data/locale/gu/katello.edit.po +0 -0
  150. data/locale/hi/katello.edit.po +0 -0
  151. data/locale/it/katello.edit.po +0 -0
  152. data/locale/ja/katello.edit.po +0 -0
  153. data/locale/kn/katello.edit.po +0 -0
  154. data/locale/ko/katello.edit.po +0 -0
  155. data/locale/mr/katello.edit.po +0 -0
  156. data/locale/or/katello.edit.po +0 -0
  157. data/locale/pa/katello.edit.po +0 -0
  158. data/locale/pt/katello.edit.po +0 -0
  159. data/locale/pt_BR/katello.edit.po +0 -0
  160. data/locale/ru/katello.edit.po +0 -0
  161. data/locale/ta/katello.edit.po +0 -0
  162. data/locale/te/katello.edit.po +0 -0
  163. data/locale/zh_CN/katello.edit.po +0 -0
  164. data/locale/zh_TW/katello.edit.po +0 -0
  165. data/package.json +1 -1
  166. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +0 -1
  167. data/webpack/__mocks__/foremanReact/components/Pagination/PaginationHooks.js +2 -0
  168. data/webpack/__mocks__/foremanReact/components/common/dates/LongDateTime.js +5 -0
  169. data/webpack/{scenes/ContentViews/Details/Repositories → components/SelectableDropdown}/SelectableDropdown.js +20 -3
  170. data/webpack/components/SelectableDropdown/__tests__/SelectableDropdown.test.js +45 -0
  171. data/webpack/components/SelectableDropdown/index.js +3 -0
  172. data/webpack/components/Table/TableWrapper.js +2 -1
  173. data/webpack/components/Table/helpers.js +14 -0
  174. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +0 -1
  175. data/webpack/containers/Application/overrides.scss +6 -0
  176. data/webpack/index.js +6 -0
  177. data/webpack/redux/actions/RedHatRepositories/helpers.js +5 -5
  178. data/webpack/scenes/ContentViews/ContentViewsActions.js +31 -2
  179. data/webpack/scenes/ContentViews/ContentViewsConstants.js +5 -1
  180. data/webpack/scenes/ContentViews/Copy/ContentViewCopySelectors.js +16 -0
  181. data/webpack/scenes/ContentViews/Copy/CopyContentViewForm.js +77 -0
  182. data/webpack/scenes/ContentViews/Copy/CopyContentViewModal.js +44 -0
  183. data/webpack/scenes/ContentViews/Copy/__tests__/contentViewCopyResult.fixtures.json +42 -0
  184. data/webpack/scenes/ContentViews/Copy/__tests__/copyContentView.test.js +39 -0
  185. data/webpack/scenes/ContentViews/Copy/index.js +4 -0
  186. data/webpack/scenes/ContentViews/Create/ContentViewCreateSelectors.js +16 -0
  187. data/webpack/scenes/ContentViews/Create/ContentViewFormComponents.js +58 -0
  188. data/webpack/scenes/ContentViews/Create/CreateContentViewForm.js +175 -0
  189. data/webpack/scenes/ContentViews/Create/CreateContentViewModal.js +27 -0
  190. data/webpack/scenes/ContentViews/Create/__tests__/contentViewCreateResult.fixtures.json +42 -0
  191. data/webpack/scenes/ContentViews/Create/__tests__/createContentView.test.js +92 -0
  192. data/webpack/scenes/ContentViews/Create/index.js +4 -0
  193. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +16 -0
  194. data/webpack/scenes/ContentViews/Details/ContentViewDetailSelectors.js +20 -1
  195. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +17 -7
  196. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +19 -13
  197. data/webpack/scenes/ContentViews/Details/Filters/ContentType.js +40 -0
  198. data/webpack/scenes/ContentViews/Details/Filters/ContentViewFilters.js +124 -0
  199. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.fixtures.json +134 -0
  200. data/webpack/scenes/ContentViews/Details/Filters/__tests__/contentViewFilters.test.js +92 -0
  201. data/webpack/scenes/ContentViews/Details/Repositories/ContentViewRepositories.js +44 -25
  202. data/webpack/scenes/ContentViews/Details/Repositories/__tests__/contentViewDetailRepos.test.js +17 -7
  203. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +24 -0
  204. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +53 -3
  205. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +4 -3
  206. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +41 -0
  207. data/webpack/scenes/ContentViews/helpers.js +13 -0
  208. data/webpack/scenes/SmartProxy/Content.js +17 -0
  209. data/webpack/scenes/SmartProxy/SmartProxyContentActions.js +11 -0
  210. data/webpack/scenes/SmartProxy/SmartProxyContentConstants.js +3 -0
  211. data/webpack/scenes/SmartProxy/SmartProxyContentSelectors.js +16 -0
  212. data/webpack/scenes/SmartProxy/SmartProxyContentTable.js +152 -0
  213. data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentResult.fixtures.json +140 -0
  214. data/webpack/scenes/SmartProxy/__tests__/SmartProxyContentTest.js +38 -0
  215. data/webpack/scenes/SmartProxy/index.js +4 -0
  216. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +2 -7
  217. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +3 -3
  218. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +2 -2
  219. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +2 -2
  220. data/webpack/scenes/Subscriptions/Manifest/index.js +0 -1
  221. data/webpack/test-utils/react-testing-lib-wrapper.js +5 -2
  222. data/webpack/utils/helpers.js +3 -0
  223. metadata +103 -63
  224. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +0 -114
  225. data/app/lib/actions/pulp3/content_migration_reset.rb +0 -22
  226. data/app/lib/katello/util/hostgroup_facets_helper.rb +0 -126
  227. data/app/overrides/disable_turbolinks_on_proxies_index.rb +0 -5
  228. data/app/services/katello/event_daemon.rb +0 -135
  229. data/app/services/katello/pulp/content_counts_calculator.rb +0 -60
  230. data/db/migrate/20210201165835_add_migration_missing_content.rb +0 -12
  231. data/db/migrate/20210420140050_add_pulp3_hrefs_to_content_types_deb.rb +0 -5
  232. data/lib/katello/tasks/check_config.rake +0 -11
  233. data/lib/katello/tasks/fix_hostgroup_facets.rake +0 -8
  234. data/lib/katello/tasks/pulp3_migration_approve_corrupted.rake +0 -21
  235. data/lib/katello/tasks/pulp3_migration_reset.rake +0 -26
  236. data/lib/katello/tasks/reports.rake +0 -7
  237. data/lib/katello/tasks/upgrades/3.10/update_gpg_key_urls.rake +0 -32
  238. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.scss +0 -5
  239. data/webpack/scenes/ContentViews/Table/actionResolver.js +0 -28
@@ -1,126 +0,0 @@
1
- # Used exclusively by fix_hostgroup_facets.rake task
2
- module Katello
3
- module Util
4
- class HostgroupFacetsHelper
5
- def initialize
6
- @logger = Logger.new($stdout)
7
- end
8
-
9
- def interested_hostgroups
10
- groups = ::Hostgroup.unscoped.where(
11
- id: Katello::Hostgroup::ContentFacet.
12
- where(content_source_id: nil,
13
- kickstart_repository_id: nil,
14
- content_view_id: nil,
15
- lifecycle_environment_id: nil).select(:hostgroup_id))
16
- parents = groups.select { |group| group.parent.blank? }
17
- children = groups.reject { |group| group.parent.blank? }
18
- # we want the parents to get created before the children
19
- # hence the order
20
- parents + children
21
- end
22
-
23
- def pick_facet_values(hg)
24
- # This call looks at the audit logs for a host group.
25
- # Pries out information related to lce, ks, cv and content_source_id from the audit logs.
26
- # The audit logs typically only contain updates.
27
- # So if the user changed just the content_view_id, then that is the only thing marked as audited_changes.
28
- # Hence we need to go through all the audit logs until we have information on lce, ks, cv and cs.
29
- # If there was only one audit log and that was during the creation of hostgroup
30
- # the audited changes look like this
31
- # ```ruby
32
- # {
33
- # content_view_id: 10,
34
- # kickstart_repository_id: 1000
35
- # ......
36
- # }
37
- # ```
38
- # However if you updated the hostgroup and set the kickstart_repository_id, or
39
- # content_view_id then audited changes look like
40
- # ```ruby
41
- # {
42
- # content_view_id: [10, 11],
43
- # kickstart_repository_id: [1000, 1200]
44
- # ......
45
- # }
46
- # ```
47
- # So the code says "if the attribute value is an array pick the last value else just keep the value as it is "
48
-
49
- # Further along it is to be noted that `hostgroup.audits` returns the audits ordered by the version number in ascending order, so the latest audit will be `hostgroup.audits.last`
50
-
51
- # We want to iterate though each audit from latest audit to start, and as soon as we find a content_view_id key or kickstart_repository_id key or lifecycle environment_id key or content_source_id key we want it to be set once.
52
-
53
- # So if I had an audit history like
54
- # ``` ruby
55
- # {
56
- # content_view_id: 10,
57
- # kickstart_repository_id: 1000,
58
- # version:1
59
- # ......
60
- # },
61
- # {
62
- # content_view_id: [10, 11],
63
- # kickstart_repository_id: [1000, 1200],
64
- # version: 2
65
- # ......
66
- # }
67
- # ```
68
-
69
- # The code would start at version 2, notice that cv_id and ks_repo were set there
70
- # and keep them as the final.
71
- # So when it goes to version 1 since cv_id and ks_repo are already set,
72
- # it will ignore. It will finally
73
- # return {content_view_id: 11, kickstart_repository_id: 1200}
74
- facet_values = {}
75
- hg.audits.reverse_each do |audit|
76
- hg_changes = audit.audited_changes.slice("lifecycle_environment_id",
77
- "kickstart_repository_id",
78
- "content_view_id",
79
- "content_source_id")
80
- facet_values = hg_changes.merge(facet_values)
81
- end
82
-
83
- values = facet_values.map do |k, v|
84
- v = v[-1] if v.is_a? Array
85
- [k, v]
86
- end
87
- values.to_h.with_indifferent_access
88
- end
89
-
90
- def main
91
- bad_hgs = []
92
- good_hgs = []
93
-
94
- groups = interested_hostgroups.each do |hg|
95
- facet = hg.content_facet
96
- values = pick_facet_values(hg)
97
- if !values.empty? && facet.update(values)
98
- good_hgs << { hostgroup: hg, facet_values: values }
99
- else
100
- bad_hgs << { hostgroup: hg, facet_values: values }
101
- facet.save(validate: false)
102
- end
103
- end
104
-
105
- unless bad_hgs.empty?
106
- @logger.warn "Some of the hostgroups reported a validation error. "\
107
- "The hostgroups have been updated. "\
108
- "Check via the Web UI."
109
-
110
- bad_hgs.each do |bad_group|
111
- @logger.warn "Hostgroup #{bad_group[:hostgroup]}"
112
- @logger.warn "Facet Values #{bad_group[:facet_values]}"
113
- end
114
- end
115
- unless good_hgs.empty?
116
- @logger.info "Following hostgroups were succesfully updated."
117
- good_hgs.each do |good_group|
118
- @logger.info "Hostgroup #{good_group[:hostgroup]}"
119
- @logger.info "Facet Values #{good_group[:facet_values]}"
120
- end
121
- end
122
- @logger.info("#{groups.count} Hostgroup(s) were updated.")
123
- end
124
- end
125
- end
126
- end
@@ -1,5 +0,0 @@
1
- Deface::Override.new(
2
- :virtual_path => 'smart_proxies/index',
3
- :name => 'disable_turbolinks_on_proxies_index',
4
- :set_attributes => '.proxy-show',
5
- :attributes => {'data-no-turbolink' => 'true'})
@@ -1,135 +0,0 @@
1
- module Katello
2
- class EventDaemon
3
- @services = {}
4
- @cache = ActiveSupport::Cache::MemoryStore.new
5
-
6
- class Monitor
7
- def initialize(service_classes)
8
- @service_classes = service_classes
9
- end
10
-
11
- def start
12
- error = nil
13
- status = nil
14
- loop do
15
- Rails.application.executor.wrap do
16
- check_services(error, status)
17
- end
18
- sleep 15
19
- end
20
- end
21
-
22
- def check_services(error, status)
23
- @service_classes.each do |service_class|
24
- status = service_class.status
25
- rescue => error
26
- Rails.logger.error("Error occurred while pinging #{service_class}")
27
- Rails.logger.error(error.message)
28
- Rails.logger.error(error.backtrace.join("\n"))
29
- ensure
30
- if error || !status&.dig(:running)
31
- begin
32
- service_class.close
33
- service_class.run
34
- service_class.status
35
- rescue => error
36
- Rails.logger.error("Error occurred while starting #{service_class}")
37
- Rails.logger.error(error.message)
38
- Rails.logger.error(error.backtrace.join("\n"))
39
- ensure
40
- error = nil
41
- end
42
- end
43
- end
44
- end
45
- end
46
-
47
- class << self
48
- def initialize
49
- FileUtils.touch(lock_file)
50
- end
51
-
52
- def settings
53
- SETTINGS[:katello][:event_daemon]
54
- end
55
-
56
- def pid
57
- return unless pid_file && File.exist?(pid_file)
58
-
59
- File.open(pid_file) { |f| f.read.to_i }
60
- end
61
-
62
- def pid_file
63
- pid_dir.join('katello_event_daemon.pid')
64
- end
65
-
66
- def pid_dir
67
- Rails.root.join('tmp', 'pids')
68
- end
69
-
70
- def lock_file
71
- Rails.root.join('tmp', 'katello_event_daemon.lock')
72
- end
73
-
74
- def write_pid_file
75
- return unless pid_file
76
-
77
- FileUtils.mkdir_p(pid_dir)
78
- File.open(pid_file, 'w') { |f| f.puts Process.pid }
79
- end
80
-
81
- def stop
82
- return unless pid == Process.pid
83
- @monitor_thread.kill
84
- @cache.clear
85
- @services.values.each(&:close)
86
- File.unlink(pid_file) if pid_file && File.exist?(pid_file)
87
- end
88
-
89
- def start
90
- return unless runnable?
91
-
92
- lockfile = File.open(lock_file, 'r')
93
- begin
94
- lockfile.flock(File::LOCK_EX)
95
- return if started? # ensure it wasn't started while we waited for the lock
96
-
97
- start_monitor_thread
98
- write_pid_file
99
-
100
- at_exit do
101
- stop
102
- end
103
-
104
- Rails.logger.info("Katello event daemon started process=#{Process.pid}")
105
- ensure
106
- lockfile.flock(File::LOCK_UN)
107
- end
108
- end
109
-
110
- def started?
111
- Process.kill(0, pid)
112
- true
113
- rescue Errno::ESRCH, TypeError # process no longer exists or we had no PID cached
114
- false
115
- end
116
-
117
- def start_monitor_thread
118
- @monitor_thread = Thread.new do
119
- Monitor.new(@services.values).start
120
- end
121
- end
122
-
123
- def runnable?
124
- # avoid accessing the disk on each request
125
- @cache.fetch('katello_event_daemon_runnable', expires_in: 1.minute) do
126
- !started? && settings[:enabled] && !::Foreman.in_rake? && !Rails.env.test?
127
- end
128
- end
129
-
130
- def register_service(name, klass)
131
- @services[name] = klass
132
- end
133
- end
134
- end
135
- end
@@ -1,60 +0,0 @@
1
- module Katello
2
- module Pulp
3
- class ContentCountsCalculator
4
- def initialize(repos)
5
- @repos = repos
6
- end
7
-
8
- # rubocop:disable Metrics/MethodLength
9
- def calculate
10
- counts = {
11
- :apt_repositories => 0,
12
- :deb_packages => 0,
13
- :yum_repositories => 0,
14
- :packages => 0,
15
- :package_groups => 0,
16
- :errata => 0,
17
- :puppet_repositories => 0,
18
- :puppet_modules => 0,
19
- :docker_repositories => 0,
20
- :docker_images => 0
21
- }
22
-
23
- @repos.each do |repo|
24
- case
25
- when repo_type?(repo, 'deb')
26
- counts[:apt_repositories] += 1
27
- counts[:deb_packages] += get_unit_count(repo, 'deb')
28
- when repo_type?(repo, 'rpm')
29
- counts[:yum_repositories] += 1
30
- counts[:packages] += get_unit_count(repo, 'rpm')
31
- counts[:package_groups] += get_unit_count(repo, 'package_group')
32
- counts[:errata] += get_unit_count(repo, 'erratum')
33
- when repo_type?(repo, 'docker')
34
- counts[:docker_repositories] += 1
35
- counts[:docker_images] += get_unit_count(repo, 'docker_image')
36
- when repo_type?(repo, 'puppet')
37
- counts[:puppet_repositories] += 1
38
- counts[:puppet_modules] += get_unit_count(repo, 'puppet_module')
39
- end
40
- end
41
-
42
- counts
43
- end
44
-
45
- protected
46
-
47
- def repo_type?(repo, repo_type)
48
- repo['notes'] && (repo['notes']['_repo-type'] == "#{repo_type}-repo")
49
- end
50
-
51
- def get_unit_count(repo, unit_type)
52
- if repo['content_unit_counts']
53
- repo['content_unit_counts'][unit_type] || 0
54
- else
55
- 0
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,12 +0,0 @@
1
- class AddMigrationMissingContent < ActiveRecord::Migration[6.0]
2
- def change
3
- content_models = [Katello::Rpm, Katello::ModuleStream, Katello::Erratum, Katello::PackageGroup, Katello::YumMetadataFile,
4
- Katello::Srpm, Katello::FileUnit, Katello::DockerManifestList, Katello::DockerManifest, Katello::DockerTag,
5
- Katello::Deb]
6
-
7
- content_models.each do |model|
8
- add_column model.table_name, :missing_from_migration, :bool, :default => false, :null => false
9
- add_column model.table_name, :ignore_missing_from_migration, :bool, :default => false, :null => false
10
- end
11
- end
12
- end
@@ -1,5 +0,0 @@
1
- class AddPulp3HrefsToContentTypesDeb < ActiveRecord::Migration[6.0]
2
- def change
3
- add_column Katello::Deb.table_name, :migrated_pulp3_href, :string, :default => nil, :null => true
4
- end
5
- end
@@ -1,11 +0,0 @@
1
- namespace :katello do
2
- task :check_config => ['environment'] do
3
- desc "Task that can be run before a content migration to check that the configuration valid"
4
- fail_msg = _("The system appears to already be using pulp3 with all content migrated.")
5
-
6
- puts "Checking for valid Katello configuraton."
7
- if SETTINGS[:katello][:use_pulp_2_for_content_type].nil?
8
- fail fail_msg
9
- end
10
- end
11
- end
@@ -1,8 +0,0 @@
1
- namespace :katello do
2
- desc "This task collates hostgroup content facts that were missed during the upgrade from audit.\
3
- It then updates the hostgroup content_facet accordingly."
4
- task :fix_hostgroup_facets => :environment do
5
- User.current = User.anonymous_admin
6
- ::Katello::Util::HostgroupFacetsHelper.new.main
7
- end
8
- end
@@ -1,21 +0,0 @@
1
- namespace :katello do
2
- desc "Marks corrupted or missing content as approved to be ignored during the migration"
3
- task :approve_corrupted_migration_content => ["dynflow:client"] do
4
- services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
5
- Katello::Ping.ping!(services: services)
6
-
7
- Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
8
- type.missing_migrated_content.update_all(:ignore_missing_from_migration => true)
9
- end
10
- puts "Any missing or corrupt content will be ignored on migration to Pulp 3. This can be undone with 'foreman-rake katello:unapprove_corrupted_migration_content'"
11
- end
12
-
13
- task :unapprove_corrupted_migration_content => ["dynflow:client"] do
14
- services = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
15
- Katello::Ping.ping!(services: services)
16
- Katello::Pulp3::Migration::CORRUPTABLE_CONTENT_TYPES.each do |type|
17
- type.ignored_missing_migrated_content.update_all(:ignore_missing_from_migration => false)
18
- end
19
- puts "Resetting approval on any corrupted or missing content, you may want to re-run the 'foreman-maintain content prepare' step to attempt re-migration."
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- namespace :katello do
2
- desc "Reset the Pulp 2 -> Pulp 3 migration for content types that haven't been fully switched over"
3
- task :pulp3_migration_reset => ["dynflow:client", "check_ping"] do
4
- puts "Starting Content Migration Reset."
5
- SmartProxy.pulp_primary.refresh
6
-
7
- task = ForemanTasks.async_task(Actions::Pulp3::ContentMigrationReset, SmartProxy.pulp_primary)
8
-
9
- if ENV['wait'].nil? || ::Foreman::Cast.to_bool(ENV['wait'])
10
- until !task.pending? || task.paused?
11
- sleep(20)
12
- task = ForemanTasks::Task.find(task.id)
13
- end
14
-
15
- if task.result == 'warning' || task.result == 'pending'
16
- msg = _("Content Migration Reset failed, You will want to investigate: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}\n")
17
- $stderr.print(msg)
18
- fail ForemanTasks::TaskError, task
19
- else
20
- puts _("Content Migration Reset completed successfully")
21
- end
22
- else
23
- puts "Content Migration Reset started, you may monitor it at: https://#{Socket.gethostname}/foreman_tasks/tasks/#{task.id}"
24
- end
25
- end
26
- end
@@ -1,7 +0,0 @@
1
- load "#{Rails.root}/lib/tasks/reports.rake"
2
-
3
- #Katello reports can generate a foreman task, so mark the task as a dynflow client
4
- ["reports:daily", "reports:weekly", "reports:monthly"].each do |task|
5
- Rake::Task[task].clear
6
- Rake::Task[task].enhance ["dynflow:client"]
7
- end
@@ -1,32 +0,0 @@
1
- namespace :katello do
2
- namespace :upgrades do
3
- namespace '3.10' do
4
- desc "Update repositories with API V1 GPG URLs"
5
- task :update_gpg_key_urls => ["environment", "katello:check_ping"] do
6
- User.current = User.anonymous_admin
7
-
8
- ::Organization.all.each do |org|
9
- org_contents = Katello::Resources::Candlepin::Content.all(org.label, include_only: [:id, :gpgUrl])
10
-
11
- org_contents.each do |cp_content|
12
- gpg_url = cp_content['gpgUrl']
13
- if gpg_url&.match(/katello\/api\/repositories/)
14
- content = Katello::Content.where(cp_content_id: cp_content['id'], organization: org).first
15
-
16
- if content.nil?
17
- Rails.logger.warn("Candlepin Content id=#{cp_content['id']} isn't in our DB. Try running 'rake katello:reimport' first.")
18
- else
19
- root_repo = Katello::RootRepository.in_organization(org).where(content_id: content.cp_content_id).first
20
- new_gpg_url = root_repo.library_instance.yum_gpg_key_url
21
- cp_content['gpgUrl'] = new_gpg_url
22
- Katello::Resources::Candlepin::Content.update(org.label, cp_content)
23
- content.gpg_url = new_gpg_url
24
- content.save!
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,5 +0,0 @@
1
- // accounting for excess padding on search bar and aligning vertically
2
- .foreman-pf4-search-clear {
3
- padding: 8px 5px 4px 5px;
4
- margin-left: 10px;
5
- }
@@ -1,28 +0,0 @@
1
- const actionResolver = (rowData, { _rowIndex }) => {
2
- // don't show actions for the expanded parts
3
- if (rowData.parent || rowData.compoundParent || rowData.noactions) return null;
4
-
5
- // printing to the console for now until these are hooked up
6
- /* eslint-disable no-console */
7
- return [
8
- {
9
- title: 'Publish and Promote',
10
- onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
11
- },
12
- {
13
- title: 'Promote',
14
- onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
15
- },
16
- {
17
- title: 'Copy',
18
- onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
19
- },
20
- {
21
- title: 'Delete',
22
- onClick: (_event, rowId, _rowInfo) => console.log(`clicked on row ${rowId}`),
23
- },
24
- ];
25
- /* eslint-enable no-console */
26
- };
27
-
28
- export default actionResolver;