katello 3.12.3 → 3.13.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 (360) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +22 -3
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +32 -15
  5. data/app/controllers/katello/api/v2/ansible_collections_controller.rb +19 -0
  6. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +3 -0
  7. data/app/controllers/katello/api/v2/content_view_puppet_modules_controller.rb +1 -0
  8. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +1 -0
  9. data/app/controllers/katello/api/v2/content_views_controller.rb +1 -0
  10. data/app/controllers/katello/api/v2/environments_controller.rb +1 -0
  11. data/app/controllers/katello/api/v2/errata_controller.rb +2 -1
  12. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +1 -0
  13. data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -0
  14. data/app/controllers/katello/api/v2/host_debs_controller.rb +34 -0
  15. data/app/controllers/katello/api/v2/host_errata_controller.rb +51 -4
  16. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -0
  17. data/app/controllers/katello/api/v2/module_streams_controller.rb +1 -0
  18. data/app/controllers/katello/api/v2/organizations_controller.rb +1 -3
  19. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +18 -0
  20. data/app/controllers/katello/api/v2/products_controller.rb +1 -0
  21. data/app/controllers/katello/api/v2/repositories_controller.rb +46 -11
  22. data/app/controllers/katello/api/v2/repository_sets_controller.rb +6 -5
  23. data/app/controllers/katello/api/v2/srpms_controller.rb +24 -0
  24. data/app/controllers/katello/api/v2/sync_plans_controller.rb +1 -0
  25. data/app/controllers/katello/application_controller.rb +1 -0
  26. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +2 -2
  27. data/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +9 -0
  28. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +2 -0
  29. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +1 -1
  30. data/app/helpers/katello/concerns/dashboard_helper_extensions.rb +13 -10
  31. data/app/lib/actions/candlepin/activation_key/create.rb +7 -1
  32. data/app/lib/actions/candlepin/activation_key/update.rb +7 -1
  33. data/app/lib/actions/candlepin/owner/destroy.rb +1 -1
  34. data/app/lib/actions/candlepin/product/update.rb +17 -0
  35. data/app/lib/actions/helpers/output_propagator.rb +13 -0
  36. data/app/lib/actions/katello/activation_key/create.rb +4 -1
  37. data/app/lib/actions/katello/activation_key/update.rb +8 -2
  38. data/app/lib/actions/katello/content_view/publish.rb +22 -34
  39. data/app/lib/actions/katello/event_queue/poller_thread.rb +22 -9
  40. data/app/lib/actions/katello/host/update.rb +3 -1
  41. data/app/lib/actions/katello/host/upload_profiles.rb +16 -0
  42. data/app/lib/actions/katello/organization/destroy.rb +0 -11
  43. data/app/lib/actions/katello/product/update.rb +8 -0
  44. data/app/lib/actions/katello/product/update_http_proxy.rb +19 -0
  45. data/app/lib/actions/katello/provider/update.rb +6 -7
  46. data/app/lib/actions/katello/pulp_selector.rb +15 -5
  47. data/app/lib/actions/katello/repository/check_matching_content.rb +3 -1
  48. data/app/lib/actions/katello/repository/clone_contents.rb +19 -6
  49. data/app/lib/actions/katello/repository/clone_to_environment.rb +3 -5
  50. data/app/lib/actions/katello/repository/create.rb +3 -1
  51. data/app/lib/actions/katello/repository/destroy.rb +5 -4
  52. data/app/lib/actions/katello/repository/discover.rb +8 -8
  53. data/app/lib/actions/katello/repository/export.rb +1 -1
  54. data/app/lib/actions/katello/repository/filtered_index_content.rb +10 -5
  55. data/app/lib/actions/katello/repository/finish_upload.rb +8 -0
  56. data/app/lib/actions/katello/repository/import_upload.rb +5 -2
  57. data/app/lib/actions/katello/repository/index_content.rb +3 -2
  58. data/app/lib/actions/katello/repository/metadata_generate.rb +10 -4
  59. data/app/lib/actions/katello/repository/remove_content.rb +11 -3
  60. data/app/lib/actions/katello/repository/sync.rb +14 -7
  61. data/app/lib/actions/katello/repository/update.rb +11 -5
  62. data/app/lib/actions/katello/repository/update_http_proxy_details.rb +17 -0
  63. data/app/lib/actions/katello/repository/upload_files.rb +7 -3
  64. data/app/lib/actions/katello/subscription/update.rb +11 -0
  65. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlement.rb +3 -0
  66. data/app/lib/actions/katello/upstream_subscriptions/remove_entitlements.rb +4 -1
  67. data/app/lib/actions/middleware/backend_services_check.rb +10 -2
  68. data/app/lib/actions/middleware/propagate_output.rb +15 -0
  69. data/app/lib/actions/middleware/pulp3_services_check.rb +9 -0
  70. data/app/lib/actions/pulp/abstract_async_task.rb +8 -1
  71. data/app/lib/actions/pulp/orchestration/repository/copy_all_units.rb +19 -0
  72. data/app/lib/actions/pulp/orchestration/repository/refresh.rb +14 -0
  73. data/app/lib/actions/pulp/orchestration/repository/refresh_if_needed.rb +13 -0
  74. data/app/lib/actions/pulp/orchestration/repository/remove_units.rb +14 -0
  75. data/app/lib/actions/pulp/orchestration/repository/sync.rb +17 -0
  76. data/app/lib/actions/pulp/repository/copy_all_units.rb +1 -1
  77. data/app/lib/actions/pulp/repository/create.rb +0 -1
  78. data/app/lib/actions/pulp/repository/refresh.rb +0 -5
  79. data/app/lib/actions/pulp/repository/remove_units.rb +1 -1
  80. data/app/lib/actions/pulp/repository/sync.rb +8 -14
  81. data/app/lib/actions/pulp3/abstract.rb +2 -1
  82. data/app/lib/actions/pulp3/abstract_async_task.rb +15 -6
  83. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +55 -0
  84. data/app/lib/actions/pulp3/orchestration/repository/create.rb +1 -2
  85. data/app/lib/actions/pulp3/orchestration/repository/delete.rb +1 -2
  86. data/app/lib/actions/pulp3/orchestration/repository/generate_metadata.rb +17 -2
  87. data/app/lib/actions/pulp3/orchestration/repository/remove_units.rb +18 -0
  88. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +19 -0
  89. data/app/lib/actions/pulp3/orchestration/repository/update.rb +15 -0
  90. data/app/lib/actions/pulp3/repository/copy_content.rb +19 -0
  91. data/app/lib/actions/pulp3/repository/copy_version.rb +19 -0
  92. data/app/lib/actions/pulp3/repository/create_publication.rb +3 -2
  93. data/app/lib/actions/pulp3/repository/presenters/abstract_sync_presenter.rb +42 -0
  94. data/app/lib/actions/pulp3/repository/presenters/content_unit_presenter.rb +57 -0
  95. data/app/lib/actions/pulp3/repository/refresh_distribution.rb +7 -3
  96. data/app/lib/actions/pulp3/repository/remove_units.rb +23 -0
  97. data/app/lib/actions/pulp3/repository/save_distribution_references.rb +6 -4
  98. data/app/lib/actions/pulp3/repository/save_publication.rb +5 -4
  99. data/app/lib/actions/pulp3/repository/save_version.rb +8 -4
  100. data/app/lib/actions/pulp3/repository/sync.rb +55 -0
  101. data/app/lib/actions/pulp3/repository/{delete_publisher.rb → update_distributions.rb} +5 -5
  102. data/app/lib/actions/pulp3/repository/{create_publisher.rb → update_remote.rb} +2 -2
  103. data/app/lib/actions/pulp3/repository/update_repository.rb +16 -0
  104. data/app/lib/katello/errors.rb +9 -0
  105. data/app/lib/katello/resources/candlepin/activation_key.rb +5 -4
  106. data/app/lib/katello/resources/candlepin/product.rb +4 -0
  107. data/app/lib/katello/resources/candlepin/upstream_consumer.rb +11 -0
  108. data/app/lib/katello/resources/candlepin/upstream_pool.rb +6 -2
  109. data/app/lib/katello/resources/cdn.rb +3 -16
  110. data/app/lib/katello/util/cdn_var_substitutor.rb +0 -3
  111. data/app/lib/katello/util/http_proxy.rb +9 -9
  112. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +1 -1
  113. data/app/models/katello/activation_key.rb +14 -0
  114. data/app/models/katello/activation_key_purpose_addon.rb +6 -0
  115. data/app/models/katello/ansible_collection.rb +32 -0
  116. data/app/models/katello/candlepin/repository_mapper.rb +1 -1
  117. data/app/models/katello/concerns/host_managed_extensions.rb +3 -0
  118. data/app/models/katello/concerns/http_proxy_extensions.rb +60 -0
  119. data/app/models/katello/concerns/location_extensions.rb +8 -0
  120. data/app/models/katello/concerns/organization_extensions.rb +9 -0
  121. data/app/models/katello/concerns/pulp_database_unit.rb +56 -81
  122. data/app/models/katello/concerns/setting_extensions.rb +14 -0
  123. data/app/models/katello/concerns/smart_proxy_extensions.rb +27 -11
  124. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +8 -1
  125. data/app/models/katello/content_view.rb +4 -0
  126. data/app/models/katello/content_view_filter.rb +4 -8
  127. data/app/models/katello/docker_tag.rb +11 -10
  128. data/app/models/katello/erratum.rb +22 -0
  129. data/app/models/katello/event.rb +2 -0
  130. data/app/models/katello/events/auto_publish_composite_view.rb +41 -0
  131. data/app/models/katello/glue/pulp/repo.rb +0 -15
  132. data/app/models/katello/host/content_facet.rb +35 -4
  133. data/app/models/katello/host/subscription_facet.rb +14 -16
  134. data/app/models/katello/host_installed_deb.rb +7 -0
  135. data/app/models/katello/installed_deb.rb +10 -0
  136. data/app/models/katello/ping.rb +45 -10
  137. data/app/models/katello/product_content.rb +1 -1
  138. data/app/models/katello/purpose_addon.rb +11 -0
  139. data/app/models/katello/repository.rb +52 -41
  140. data/app/models/katello/repository_ansible_collection.rb +6 -0
  141. data/app/models/katello/repository_content_view_filter.rb +7 -0
  142. data/app/models/katello/rhsm_fact_parser.rb +11 -1
  143. data/app/models/katello/root_repository.rb +46 -4
  144. data/app/models/katello/srpm.rb +4 -0
  145. data/app/models/katello/subscription_facet_purpose_addon.rb +6 -0
  146. data/app/models/katello/yum_metadata_file.rb +3 -3
  147. data/app/models/setting/content.rb +32 -7
  148. data/app/overrides/add_about_page.rb +0 -7
  149. data/app/services/cert/certs.rb +1 -1
  150. data/app/services/katello/candlepin/consumer.rb +4 -0
  151. data/app/services/katello/event_queue.rb +33 -3
  152. data/app/services/katello/pulp/content_counts_calculator.rb +6 -0
  153. data/app/services/katello/pulp/docker_manifest.rb +1 -2
  154. data/app/services/katello/pulp/docker_manifest_list.rb +0 -1
  155. data/app/services/katello/pulp/file_unit.rb +1 -1
  156. data/app/services/katello/pulp/pulp_content_unit.rb +43 -0
  157. data/app/services/katello/pulp/repository.rb +32 -5
  158. data/app/services/katello/pulp/repository/file.rb +6 -1
  159. data/app/services/katello/pulp/repository/yum.rb +6 -6
  160. data/app/services/katello/pulp/rpm.rb +1 -1
  161. data/app/services/katello/pulp/srpm.rb +1 -1
  162. data/app/services/katello/pulp3/ansible_collection.rb +31 -0
  163. data/app/services/katello/pulp3/docker_blob.rb +17 -0
  164. data/app/services/katello/pulp3/docker_manifest.rb +36 -0
  165. data/app/services/katello/pulp3/docker_manifest_list.rb +30 -0
  166. data/app/services/katello/pulp3/docker_tag.rb +28 -0
  167. data/app/services/katello/pulp3/file_unit.rb +25 -0
  168. data/app/services/katello/pulp3/pulp_content_unit.rb +75 -0
  169. data/app/services/katello/pulp3/repository.rb +160 -47
  170. data/app/services/katello/pulp3/repository/ansible_collection.rb +49 -0
  171. data/app/services/katello/pulp3/repository/docker.rb +55 -0
  172. data/app/services/katello/pulp3/repository/file.rb +35 -25
  173. data/app/services/katello/repository_type.rb +15 -5
  174. data/app/services/katello/repository_type_manager.rb +32 -1
  175. data/app/views/dashboard/_subscription_widget.html.erb +7 -7
  176. data/app/views/foreman/smart_proxies/_content_tab.html.erb +5 -1
  177. data/app/views/katello/api/v2/activation_keys/base.json.rabl +5 -1
  178. data/app/views/katello/api/v2/ansible_collections/base.json.rabl +7 -0
  179. data/app/views/katello/api/v2/ansible_collections/index.json.rabl +7 -0
  180. data/app/views/katello/api/v2/ansible_collections/show.json.rabl +3 -0
  181. data/app/views/katello/api/v2/host_debs/base.json.rabl +4 -0
  182. data/app/views/katello/api/v2/host_debs/index.json.rabl +7 -0
  183. data/app/views/katello/api/v2/ping/show.json.rabl +2 -1
  184. data/app/views/katello/api/v2/repositories/base.json.rabl +3 -2
  185. data/app/views/katello/api/v2/repositories/show.json.rabl +8 -1
  186. data/app/views/katello/api/v2/srpms/index.json.rabl +7 -0
  187. data/app/views/katello/api/v2/srpms/show.json.rabl +5 -0
  188. data/app/views/katello/api/v2/subscription_facet/base.json.rabl +5 -1
  189. data/config/katello.yaml.example +1 -0
  190. data/config/routes/api/rhsm.rb +1 -0
  191. data/config/routes/api/v2.rb +16 -0
  192. data/config/routes/overrides.rb +4 -0
  193. data/db/migrate/20180502155123_add_installed_deb.rb +23 -0
  194. data/db/migrate/20190513162209_drop_repository_reference_publisher_href.rb +5 -0
  195. data/db/migrate/20190605014649_add_purpose_addons.rb +29 -0
  196. data/db/migrate/20190617142328_create_katello_ansible_collections.rb +25 -0
  197. data/db/migrate/20190618034438_add_ansible_collection_whitelist_to_katello_root_repositories.rb +5 -0
  198. data/db/migrate/20190619192151_add_activation_key_system_purpose_attributes.rb +14 -0
  199. data/db/migrate/20190701174401_add_http_proxy_policy_to_repository_root.rb +12 -0
  200. data/db/migrate/20190701192616_add_http_proxy_to_repository_root.rb +6 -0
  201. data/db/migrate/20190702182118_add_metadata_process_after_to_katello_event.rb +6 -0
  202. data/db/migrate/20190708195809_remove_all_manifest_downloaded.rb +11 -0
  203. data/db/migrate/20190723171639_update_content_view_filters_repositories_join_table.rb +11 -0
  204. data/db/seeds.d/115-http_proxy.rb +25 -0
  205. data/engines/bastion/app/views/bastion/layouts/assets.html.erb +1 -0
  206. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details-info.controller.js +15 -0
  207. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +69 -4
  208. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html +39 -0
  209. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
  210. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
  211. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +2 -1
  212. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -7
  213. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js +26 -0
  214. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-actions.controller.js +14 -0
  215. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs-installed.controller.js +77 -0
  216. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-debs.controller.js +63 -0
  217. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +18 -21
  218. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs-actions.html +62 -0
  219. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs-installed.html +52 -0
  220. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-debs.html +9 -0
  221. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +1 -1
  222. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +21 -1
  223. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -1
  224. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +1 -2
  225. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +1 -1
  226. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-yum.html +4 -4
  227. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-debs.factory.js +20 -0
  228. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host.factory.js +9 -0
  229. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/http-proxies/http-proxies.module.js +14 -0
  230. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/http-proxies/http-proxy.factory.js +21 -0
  231. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +2 -1
  232. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/products-bulk-http-proxy-modal.controller.js +77 -0
  233. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-http-proxy-modal.html +57 -0
  234. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +25 -3
  235. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.filter.js +13 -1
  236. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +75 -29
  237. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/http-proxy-service.js +53 -0
  238. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +18 -2
  239. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +42 -16
  240. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/views/product-repositories.html +7 -0
  241. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +16 -0
  242. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +6 -0
  243. data/lib/katello.rb +0 -1
  244. data/lib/katello/engine.rb +2 -0
  245. data/lib/katello/permission_creator.rb +7 -2
  246. data/lib/katello/permissions/host_permissions.rb +3 -0
  247. data/lib/katello/plugin.rb +3 -2
  248. data/lib/katello/repository_types/ansible_collection.rb +8 -0
  249. data/lib/katello/repository_types/deb.rb +2 -1
  250. data/lib/katello/repository_types/docker.rb +23 -4
  251. data/lib/katello/repository_types/file.rb +7 -1
  252. data/lib/katello/repository_types/ostree.rb +2 -1
  253. data/lib/katello/repository_types/puppet.rb +2 -1
  254. data/lib/katello/repository_types/yum.rb +3 -2
  255. data/lib/katello/tasks/clean_published_repo_directories.rake +1 -1
  256. data/lib/katello/tasks/delete_orphaned_content.rake +16 -5
  257. data/lib/katello/tasks/jenkins.rake +2 -0
  258. data/lib/katello/tasks/update_content_default_http_proxy.rake +69 -0
  259. data/lib/katello/version.rb +1 -1
  260. data/package.json +10 -22
  261. data/webpack/{move_to_foreman/__mocks__ → __mocks__/foremanJS}/foreman_toast_notifications.js +0 -0
  262. data/webpack/__mocks__/foremanReact/common/helpers.js +3 -6
  263. data/webpack/__mocks__/foremanReact/common/keyCodes.js +8 -0
  264. data/webpack/__mocks__/foremanReact/common/urlHelpers.js +7 -0
  265. data/webpack/__mocks__/foremanReact/components/Settings/SettingsActions.js +4 -0
  266. data/webpack/__mocks__/foremanReact/components/Settings/SettingsConstants.js +2 -0
  267. data/webpack/__mocks__/foremanReact/components/common/Fill/GlobalFill.js +3 -0
  268. data/webpack/__mocks__/foremanReact/components/common/ModalProgressBar.js +8 -0
  269. data/webpack/components/SelectOrg/SetOrganization.js +11 -19
  270. data/webpack/components/WithOrganization/__snapshots__/withOrganization.test.js.snap +1 -3
  271. data/webpack/components/WithOrganization/withOrganization.js +2 -2
  272. data/webpack/components/WithOrganization/withOrganization.test.js +2 -2
  273. data/webpack/components/extensions/about/SystemStatuses.js +55 -0
  274. data/webpack/components/extensions/about/SystemStatusesActions.js +16 -0
  275. data/webpack/components/extensions/about/SystemStatusesConsts.js +3 -0
  276. data/webpack/components/extensions/about/SystemStatusesReducer.js +26 -0
  277. data/webpack/components/extensions/about/SystemStatusesSelectors.js +3 -0
  278. data/webpack/components/extensions/about/__tests__/SystemStatuses.fixtures.js +20 -0
  279. data/webpack/components/extensions/about/__tests__/SystemStatuses.test.js +14 -0
  280. data/webpack/components/extensions/about/__tests__/SystemStatusesReducer.test.js +32 -0
  281. data/webpack/components/extensions/about/__tests__/__snapshots__/SystemStatuses.test.js.snap +156 -0
  282. data/webpack/components/extensions/about/__tests__/__snapshots__/SystemStatusesReducer.test.js.snap +47 -0
  283. data/webpack/components/extensions/about/index.js +19 -0
  284. data/webpack/components/extensions/reducers.js +6 -0
  285. data/webpack/containers/Application/config.js +4 -10
  286. data/webpack/fills_index.js +10 -0
  287. data/webpack/move_to_foreman/common/helpers.js +0 -20
  288. data/webpack/move_to_foreman/components/common/table/components/TableSelectionCell.js +1 -0
  289. data/webpack/move_to_foreman/components/common/table/formatters/EntitlementsInlineEditFormatter.js +3 -3
  290. data/webpack/move_to_pf/LoadingState/LoadingState.js +1 -0
  291. data/webpack/move_to_pf/OptionTooltip/OptionTooltip.scss +2 -1
  292. data/webpack/move_to_pf/TypeAhead/TypeAhead.js +3 -4
  293. data/webpack/redux/actions/RedHatRepositories/helpers.js +6 -1
  294. data/webpack/redux/reducers/index.js +2 -0
  295. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetailInfo.js +1 -0
  296. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetails.js +1 -0
  297. data/webpack/scenes/ModuleStreams/Details/Profiles/TableSchema.js +1 -0
  298. data/webpack/scenes/ModuleStreams/Details/Profiles/__tests__/ProfileRpmsCellFormatter.test.js +0 -2
  299. data/webpack/scenes/ModuleStreams/Details/Repositories/TableSchema.js +3 -2
  300. data/webpack/scenes/ModuleStreams/Details/index.js +1 -1
  301. data/webpack/scenes/ModuleStreams/ModuleStreamsPage.js +2 -0
  302. data/webpack/scenes/ModuleStreams/ModuleStreamsTable.js +2 -0
  303. data/webpack/scenes/ModuleStreams/ModuleStreamsTableSchema.js +3 -2
  304. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamPage.test.js +0 -1
  305. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +0 -1
  306. data/webpack/scenes/ModuleStreams/index.js +1 -1
  307. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepository.js +2 -3
  308. data/webpack/scenes/RedHatRepositories/components/EnabledRepository/EnabledRepositoryContent.js +1 -0
  309. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.js +1 -0
  310. data/webpack/scenes/RedHatRepositories/components/RecommendedRepositorySetsToggler.scss +1 -1
  311. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepositories.js +1 -0
  312. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/RepositorySetRepository.js +3 -4
  313. data/webpack/scenes/RedHatRepositories/components/RepositorySetRepository/__test__/RepositorySetRepository.test.js +0 -2
  314. data/webpack/scenes/RedHatRepositories/components/SearchBar.js +1 -0
  315. data/webpack/scenes/RedHatRepositories/helpers.js +1 -1
  316. data/webpack/scenes/RedHatRepositories/index.js +3 -2
  317. data/webpack/scenes/RedHatRepositories/index.scss +1 -1
  318. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailAssociations.js +3 -3
  319. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProductContent.js +1 -0
  320. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailProducts.js +1 -0
  321. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +1 -2
  322. data/webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetails.test.js +0 -1
  323. data/webpack/scenes/Subscriptions/Details/index.js +1 -1
  324. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +1 -0
  325. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +1 -2
  326. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +1 -1
  327. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +3 -2
  328. data/webpack/scenes/Subscriptions/SubscriptionsPage.scss +1 -2
  329. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +9 -9
  330. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +2 -2
  331. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/__tests__/UpstreamSubscriptionsPage.test.js +0 -1
  332. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/index.js +1 -1
  333. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsPage.test.js +1 -2
  334. data/webpack/scenes/Subscriptions/__tests__/SubscriptionsReducer.test.js +2 -1
  335. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +2 -1
  336. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionTypeFormatter.js +3 -2
  337. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +1 -0
  338. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +3 -2
  339. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/SubscriptionsTable.test.js +1 -1
  340. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/DeleteDialog.js +1 -1
  341. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/InputsErrorsDialog.js +1 -0
  342. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UnsavedChangesDialog.js +1 -0
  343. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Dialogs/UpdateDialog.js +1 -1
  344. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +1 -0
  345. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +1 -0
  346. data/webpack/scenes/Subscriptions/index.js +1 -1
  347. data/webpack/scenes/Tasks/helpers.js +5 -6
  348. metadata +161 -20
  349. data/app/lib/actions/katello/repository/clear.rb +0 -11
  350. data/app/views/overrides/about/_system_status.html.erb +0 -19
  351. data/webpack/move_to_foreman/Settings/SettingsActions.js +0 -28
  352. data/webpack/move_to_foreman/Settings/SettingsConstants.js +0 -3
  353. data/webpack/move_to_foreman/Settings/__tests__/SettingsActions.test.js +0 -41
  354. data/webpack/move_to_foreman/Settings/__tests__/settings.fixtures.js +0 -34
  355. data/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.js +0 -48
  356. data/webpack/move_to_foreman/components/common/ModalProgressBar/ModalProgressBar.scss +0 -15
  357. data/webpack/move_to_foreman/components/common/ModalProgressBar/__tests__/ModalProgressBar.test.js +0 -22
  358. data/webpack/move_to_foreman/components/common/ModalProgressBar/__tests__/__snapshots__/ModalProgressBar.test.js.snap +0 -60
  359. data/webpack/move_to_foreman/components/common/ModalProgressBar/index.js +0 -4
  360. data/webpack/move_to_foreman/foreman_toast_notifications.js +0 -22
@@ -0,0 +1,7 @@
1
+ module Katello
2
+ class HostInstalledDeb < Katello::Model
3
+ # Do not use active record callbacks in this join model. Direct INSERTs and DELETEs are done
4
+ belongs_to :host, :inverse_of => :host_installed_debs, :class_name => '::Host::Managed'
5
+ belongs_to :installed_deb, :inverse_of => :host_installed_debs, :class_name => 'Katello::InstalledDeb'
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Katello
2
+ class InstalledDeb < Katello::Model
3
+ has_many :hosts, :through => :host_installed_debs, :class_name => "::Host"
4
+ has_many :host_installed_debs, :class_name => "Katello::HostInstalledDeb", :dependent => :destroy, :inverse_of => :installed_deb
5
+
6
+ scoped_search :on => :name, :complete_value => true
7
+ scoped_search :on => :version
8
+ scoped_search :on => :architecture
9
+ end
10
+ end
@@ -3,17 +3,22 @@ module Katello
3
3
  OK_RETURN_CODE = 'ok'.freeze
4
4
  FAIL_RETURN_CODE = 'FAIL'.freeze
5
5
  PACKAGES = %w(katello candlepin pulp qpid foreman tfm hammer).freeze
6
-
7
- SERVICES = [:pulp, :pulp_auth, :candlepin, :candlepin_auth, :foreman_tasks].freeze
8
-
9
6
  class << self
7
+ def services(capsule_id = nil)
8
+ services = [:pulp, :pulp_auth, :candlepin, :candlepin_auth, :foreman_tasks]
9
+ services += [:pulp3] if fetch_proxy(capsule_id)&.pulp3_enabled?
10
+ services
11
+ end
12
+
10
13
  #
11
14
  # Calls "status" services in all backend engines.
12
15
  #
13
- def ping(services: SERVICES, capsule_id: nil)
16
+ def ping(services: nil, capsule_id: nil)
17
+ services ||= self.services(capsule_id)
14
18
  result = {}
15
19
  services.each { |service| result[service] = {} }
16
20
 
21
+ ping_pulp3_without_auth(result[:pulp3], capsule_id) if result.include?(:pulp3)
17
22
  ping_pulp_without_auth(result[:pulp], capsule_id) if result.include?(:pulp)
18
23
  ping_candlepin_without_auth(result[:candlepin]) if result.include?(:candlepin)
19
24
 
@@ -29,6 +34,12 @@ module Katello
29
34
  result
30
35
  end
31
36
 
37
+ def ping_pulp3_without_auth(service_result, capsule_id)
38
+ exception_watch(service_result) do
39
+ Ping.pulp3_without_auth(fetch_proxy(capsule_id).pulp3_url("api/v3"))
40
+ end
41
+ end
42
+
32
43
  def ping_pulp_without_auth(service_result, capsule_id)
33
44
  exception_watch(service_result) do
34
45
  Ping.pulp_without_auth(pulp_url(capsule_id))
@@ -105,12 +116,9 @@ module Katello
105
116
  end
106
117
 
107
118
  def pulp_url(capsule_id)
108
- if capsule_id
109
- uri = URI.parse(SmartProxy.find(capsule_id).pulp_url)
110
- "#{uri.scheme}://#{uri.host.downcase}/pulp/api/v2"
111
- else
112
- SETTINGS[:katello][:pulp][:url]
113
- end
119
+ proxy = fetch_proxy(capsule_id)
120
+ uri = URI.parse(proxy.pulp_url)
121
+ "#{uri.scheme}://#{uri.host.downcase}/pulp/api/v2"
114
122
  end
115
123
 
116
124
  # this checks Pulp is running and responding without need
@@ -137,6 +145,29 @@ module Katello
137
145
  json
138
146
  end
139
147
 
148
+ def pulp3_without_auth(url)
149
+ json = backend_status(url, :pulp)
150
+ fail _("Pulp does not appear to be running at %s.") % url if json.empty?
151
+
152
+ if json['database_connection'] && json['database_connection']['connected'] != true
153
+ fail _("Pulp database connection issue at %s.") % url
154
+ end
155
+
156
+ if json['redis_connection'] && json['redis_connection']['connected'] != true
157
+ fail _("Pulp redis connection issue at %s.") % url
158
+ end
159
+
160
+ workers = json["online_workers"] || []
161
+ resource_manager_exists = workers.any? { |worker| worker["name"].include?("resource-manager@") }
162
+ reservered_resource_worker_exists = workers.any? { |worker| worker["name"] =~ /reserved-resource-worker-./ }
163
+
164
+ unless resource_manager_exists && reservered_resource_worker_exists
165
+ fail _("Not all necessary pulp workers running at %s.") % url
166
+ end
167
+
168
+ json
169
+ end
170
+
140
171
  def all_pulp_workers_present?(json)
141
172
  worker_ids = json["known_workers"].collect { |worker| worker["_id"] }
142
173
  return false unless worker_ids.any?
@@ -148,6 +179,10 @@ module Katello
148
179
 
149
180
  private
150
181
 
182
+ def fetch_proxy(capsule_id)
183
+ capsule_id ? SmartProxy.find(capsule_id) : SmartProxy.pulp_master
184
+ end
185
+
151
186
  def backend_status(url, backend)
152
187
  ca_file = SETTINGS[:katello][backend][:ca_cert_file]
153
188
  options = {}
@@ -36,7 +36,7 @@ module Katello
36
36
 
37
37
  # used by Katello::Api::V2::RepositorySetsController#index
38
38
  def repositories
39
- Katello::Repository.where(:root_id => product.root_repositories.has_url.where(:content_id => content.cp_content_id))
39
+ Katello::Repository.in_default_view.where(:root_id => product.root_repositories.has_url.where(:content_id => content.cp_content_id))
40
40
  end
41
41
  end
42
42
  end
@@ -0,0 +1,11 @@
1
+ module Katello
2
+ class PurposeAddon < Katello::Model
3
+ self.table_name = 'katello_purpose_addons'
4
+
5
+ has_many :subscription_facet_purpose_addons, :class_name => "Katello::SubscriptionFacetPurposeAddon", :dependent => :destroy, :inverse_of => :purpose_addon
6
+ has_many :subscription_facets, :through => :subscription_facet_purpose_addons, :class_name => "Katello::Host::SubscriptionFacet"
7
+
8
+ has_many :activation_key_purpose_addons, :class_name => "Katello::ActivationKeyPurposeAddon", :dependent => :destroy, :inverse_of => :purpose_addon
9
+ has_many :activation_keys, :through => :activation_key_purpose_addons, :class_name => "Katello::ActivationKey"
10
+ end
11
+ end
@@ -25,6 +25,7 @@ module Katello
25
25
  PUPPET_TYPE = 'puppet'.freeze
26
26
  DOCKER_TYPE = 'docker'.freeze
27
27
  OSTREE_TYPE = 'ostree'.freeze
28
+ ANSIBLE_COLLECTION_TYPE = 'ansible_collection'.freeze
28
29
 
29
30
  define_model_callbacks :sync, :only => :after
30
31
 
@@ -90,11 +91,11 @@ module Katello
90
91
  has_many :repository_module_streams, class_name: "Katello::RepositoryModuleStream", dependent: :delete_all
91
92
  has_many :module_streams, through: :repository_module_streams
92
93
 
93
- # rubocop:disable HasAndBelongsToMany
94
- # TODO: change this into has_many :through association
95
- has_and_belongs_to_many :filters, :class_name => "Katello::ContentViewFilter",
96
- :join_table => :katello_content_view_filters_repositories,
97
- :foreign_key => :content_view_filter_id
94
+ has_many :repository_ansible_collections, :class_name => "Katello::RepositoryAnsibleCollection", :dependent => :delete_all
95
+ has_many :ansible_collections, :through => :repository_ansible_collections
96
+ has_many :repository_content_view_filters, :class_name => "Katello::RepositoryContentViewFilter", :dependent => :delete_all
97
+ has_many :filters, :through => :repository_content_view_filters
98
+
98
99
  belongs_to :content_view_version, :inverse_of => :repositories, :class_name => "Katello::ContentViewVersion"
99
100
 
100
101
  validates_with Validators::ContainerImageNameValidator, :attributes => :container_repository_name, :allow_blank => false, :if => :docker?
@@ -116,6 +117,7 @@ module Katello
116
117
  scope :puppet_type, -> { with_type(PUPPET_TYPE) }
117
118
  scope :docker_type, -> { with_type(DOCKER_TYPE) }
118
119
  scope :ostree_type, -> { with_type(OSTREE_TYPE) }
120
+ scope :ansible_collection_type, -> { with_type(ANSIBLE_COLLECTION_TYPE) }
119
121
  scope :non_puppet, -> { with_type(RepositoryTypeManager.repository_types.keys - [PUPPET_TYPE]) }
120
122
  scope :non_archived, -> { where('environment_id is not NULL') }
121
123
  scope :archived, -> { where('environment_id is NULL') }
@@ -145,7 +147,7 @@ module Katello
145
147
  scoped_search :on => :content_label, :ext_method => :search_by_content_label
146
148
 
147
149
  delegate :product, :redhat?, :custom?, :to => :root
148
- delegate :yum?, :docker?, :puppet?, :deb?, :file?, :ostree?, :to => :root
150
+ delegate :yum?, :docker?, :puppet?, :deb?, :file?, :ostree?, :ansible_collection?, :to => :root
149
151
  delegate :name, :label, :docker_upstream_name, :url, :to => :root
150
152
 
151
153
  delegate :name, :created_at, :updated_at, :major, :minor, :gpg_key_id, :gpg_key, :content_id, :arch, :label, :url, :unprotected,
@@ -153,7 +155,7 @@ module Katello
153
155
  :download_policy, :verify_ssl_on_sync, :"verify_ssl_on_sync?", :upstream_username, :upstream_password,
154
156
  :ostree_upstream_sync_policy, :ostree_upstream_sync_depth, :deb_releases, :deb_components, :deb_architectures,
155
157
  :ignore_global_proxy, :ssl_ca_cert_id, :ssl_ca_cert, :ssl_client_cert, :ssl_client_cert_id, :ssl_client_key_id,
156
- :ssl_client_key, :ignorable_content, :description, :docker_tags_whitelist, :to => :root
158
+ :ssl_client_key, :ignorable_content, :description, :docker_tags_whitelist, :ansible_collection_whitelist, :http_proxy_policy, :http_proxy_id, :to => :root
157
159
 
158
160
  def self.with_type(content_type)
159
161
  joins(:root).where("#{RootRepository.table_name}.content_type" => content_type)
@@ -265,30 +267,40 @@ module Katello
265
267
  redhat? ? "redhat" : "custom"
266
268
  end
267
269
 
268
- def empty_errata
270
+ def self.errata_with_package_counts(repo)
269
271
  repository_rpm = Katello::RepositoryRpm.table_name
270
272
  repository_errata = Katello::RepositoryErratum.table_name
271
273
  rpm = Katello::Rpm.table_name
272
274
  errata = Katello::Erratum.table_name
273
275
  erratum_package = Katello::ErratumPackage.table_name
274
-
275
- errata_with_packages = Erratum.joins(
276
+ ::Katello::Erratum.joins(
276
277
  "INNER JOIN #{erratum_package} on #{erratum_package}.erratum_id = #{errata}.id",
277
278
  "INNER JOIN #{repository_errata} on #{repository_errata}.erratum_id = #{errata}.id",
278
279
  "INNER JOIN #{rpm} on #{rpm}.filename = #{erratum_package}.filename",
279
280
  "INNER JOIN #{repository_rpm} on #{repository_rpm}.rpm_id = #{rpm}.id").
280
- where("#{repository_rpm}.repository_id" => self.id).
281
- where("#{repository_errata}.repository_id" => self.id)
281
+ where("#{repository_rpm}.repository_id" => repo.id).
282
+ where("#{repository_errata}.repository_id" => repo.id).
283
+ group("#{errata}.id").count
284
+ end
282
285
 
283
- if errata_with_packages.any?
284
- self.errata.where("#{Katello::Erratum.table_name}.id NOT IN (?)", errata_with_packages.pluck("#{errata}.id"))
285
- else
286
- self.errata
286
+ def partial_errata
287
+ return [] if library_instance?
288
+
289
+ errata_with_package_counts = ::Katello::Repository.errata_with_package_counts(self)
290
+ partial_errata = self.errata
291
+ if errata_with_package_counts.any?
292
+ errata_with_packages_in_library = ::Katello::Repository.errata_with_package_counts(library_instance)
293
+ errata_with_package_counts.keep_if { |id| errata_with_package_counts[id] == errata_with_packages_in_library[id] }
294
+ unless errata_with_package_counts.empty?
295
+ partial_errata = self.errata.where("#{Katello::Erratum.table_name}.id NOT IN (?)", errata_with_package_counts.keys)
296
+ end
287
297
  end
298
+
299
+ partial_errata
288
300
  end
289
301
 
290
- def empty_errata!
291
- found = empty_errata.to_a
302
+ def remove_partial_errata!
303
+ found = partial_errata.to_a
292
304
  yield(found) if block_given?
293
305
  self.repository_errata.where(:erratum_id => found.map(&:id)).delete_all
294
306
  found
@@ -521,14 +533,15 @@ module Katello
521
533
  self.ostree_branches.map(&:name)
522
534
  end
523
535
 
524
- def units_for_removal(ids)
536
+ def units_for_removal(ids, type_class = nil)
537
+ removable_unit_association = unit_type_for_removal(type_class)
525
538
  table_name = removable_unit_association.table_name
526
539
  is_integer = Integer(ids.first) rescue false #assume all ids are either integers or not
527
540
 
528
541
  if is_integer
529
- self.removable_unit_association.where("#{table_name}.id in (?)", ids)
542
+ removable_unit_association.where("#{table_name}.id in (?)", ids)
530
543
  else
531
- self.removable_unit_association.where("#{table_name}.pulp_id in (?)", ids)
544
+ removable_unit_association.where("#{table_name}.pulp_id in (?)", ids)
532
545
  end
533
546
  end
534
547
 
@@ -739,23 +752,31 @@ module Katello
739
752
  RepositoryTypeManager.find(self.content_type)
740
753
  end
741
754
 
755
+ def copy_indexed_data(source_repository)
756
+ repository_type.content_types_to_index.each do |type|
757
+ type.model_class.copy_repository_associations(source_repository, self)
758
+ repository_type.index_additional_data_proc&.call(self, source_repository)
759
+ end
760
+ end
761
+
742
762
  def index_linked_repo
743
763
  if (base_repo = self.target_repository)
744
- repository_type.content_types_to_index.each do |type|
745
- type.model_class.copy_repository_associations(base_repo, self)
746
- repository_type.index_additional_data_proc&.call(self, target_repository)
747
- end
764
+ copy_indexed_data(base_repo)
748
765
  else
749
766
  Rails.logger.error("Cannot index #{self.id}, no target repository found.")
750
767
  end
751
768
  end
752
769
 
753
- def index_content(full_index = false)
770
+ def index_content(options = {})
771
+ source_repository = options.fetch(:source_repository, nil)
772
+
754
773
  if self.yum? && !self.master?
755
774
  index_linked_repo
775
+ elsif source_repository
776
+ copy_indexed_data(source_repository)
756
777
  else
757
778
  repository_type.content_types_to_index.each do |type|
758
- type.model_class.import_for_repository(self, full_index)
779
+ type.model_class.import_for_repository(self)
759
780
  end
760
781
  repository_type.index_additional_data_proc&.call(self)
761
782
  end
@@ -764,21 +785,11 @@ module Katello
764
785
 
765
786
  protected
766
787
 
767
- def removable_unit_association
768
- if yum?
769
- self.rpms
770
- elsif docker?
771
- self.docker_manifests
772
- elsif puppet?
773
- self.puppet_modules
774
- elsif ostree?
775
- self.ostree_branches
776
- elsif file?
777
- self.files
778
- elsif deb?
779
- self.debs
788
+ def unit_type_for_removal(type_class = nil)
789
+ if type_class
790
+ Katello::RepositoryTypeManager.find_content_type(type_class).model_class
780
791
  else
781
- fail "Content type not supported for removal"
792
+ Katello::RepositoryTypeManager.find(self.content_type).default_managed_content_type.model_class
782
793
  end
783
794
  end
784
795
 
@@ -0,0 +1,6 @@
1
+ module Katello
2
+ class RepositoryAnsibleCollection < Katello::Model
3
+ belongs_to :repository, inverse_of: :repository_ansible_collections, class_name: 'Katello::Repository'
4
+ belongs_to :ansible_collection, inverse_of: :repository_ansible_collections, class_name: 'Katello::AnsibleCollection'
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ module Katello
2
+ class RepositoryContentViewFilter < Katello::Model
3
+ # Do not use active record callbacks in this join model. Direct INSERTs and DELETEs are done
4
+ belongs_to :repository, :inverse_of => :repository_content_view_filters, :class_name => 'Katello::Repository'
5
+ belongs_to :filter, :inverse_of => :repository_content_view_filters, :class_name => 'Katello::ContentViewFilter', :foreign_key => :content_view_filter_id
6
+ end
7
+ end
@@ -54,11 +54,17 @@ module Katello
54
54
  os_name = ::Katello::Candlepin::Consumer.distribution_to_puppet_os(name)
55
55
  major, minor = version.split('.')
56
56
  if os_name && !invalid_centos_os?(os_name, minor)
57
- os_attributes = {:major => major, :minor => minor || '', :name => os_name}
57
+ os_attributes = {:major => major, :minor => minor || '', :name => os_name, :release_name => os_release_name(os_name)}
58
58
  ::Operatingsystem.find_by(os_attributes) || ::Operatingsystem.create!(os_attributes)
59
59
  end
60
60
  end
61
61
 
62
+ def os_release_name(os_name)
63
+ if os_name.match(::Operatingsystem::FAMILIES['Debian'])
64
+ facts['distribution.id']
65
+ end
66
+ end
67
+
62
68
  def invalid_centos_os?(name, minor_version)
63
69
  name == 'CentOS' && minor_version.blank?
64
70
  end
@@ -73,6 +79,10 @@ module Katello
73
79
  def ipmi_interface
74
80
  end
75
81
 
82
+ def boot_timestamp
83
+ facts['proc_stat.btime']&.to_i
84
+ end
85
+
76
86
  private
77
87
 
78
88
  def get_rhsm_ip(interface)
@@ -23,11 +23,20 @@ module Katello
23
23
 
24
24
  }.freeze
25
25
 
26
+ NO_DEFAULT_HTTP_PROXY = 'none'.freeze
27
+ GLOBAL_DEFAULT_HTTP_PROXY = 'global_default_http_proxy'.freeze
28
+ USE_SELECTED_HTTP_PROXY = 'use_selected_http_proxy'.freeze
29
+ HTTP_PROXY_POLICIES = [
30
+ GLOBAL_DEFAULT_HTTP_PROXY,
31
+ NO_DEFAULT_HTTP_PROXY,
32
+ USE_SELECTED_HTTP_PROXY].freeze
33
+
26
34
  belongs_to :product, :inverse_of => :root_repositories, :class_name => "Katello::Product"
27
35
  belongs_to :gpg_key, :inverse_of => :root_repositories, :class_name => "Katello::GpgKey"
28
36
  belongs_to :ssl_ca_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_ca_root_repos
29
37
  belongs_to :ssl_client_cert, :class_name => "Katello::GpgKey", :inverse_of => :ssl_client_root_repos
30
38
  belongs_to :ssl_client_key, :class_name => "Katello::GpgKey", :inverse_of => :ssl_key_root_repos
39
+ belongs_to :http_proxy, :inverse_of => :root_repositories
31
40
  has_many :repositories, :class_name => "Katello::Repository", :foreign_key => :root_id,
32
41
  :inverse_of => :root, :dependent => :destroy
33
42
 
@@ -48,6 +57,7 @@ module Katello
48
57
  validates_with Validators::ContainerImageNameValidator, :attributes => :docker_upstream_name, :allow_blank => true, :if => :docker?
49
58
 
50
59
  validate :ensure_valid_docker_attributes, :if => :docker?
60
+ validate :ensure_valid_ansible_collection_attributes, :if => :ansible_collection?
51
61
  validate :ensure_docker_repo_unprotected, :if => :docker?
52
62
  validate :ensure_ostree_repo_protected, :if => :ostree?
53
63
  validate :ensure_compatible_download_policy, :if => :yum?
@@ -71,7 +81,10 @@ module Katello
71
81
  :in => ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES,
72
82
  :message => _("must be one of the following: %s") % ::Runcible::Models::YumImporter::DOWNLOAD_POLICIES.join(', ')
73
83
  }, if: :yum?
74
-
84
+ validates :http_proxy_policy, inclusion: {
85
+ :in => HTTP_PROXY_POLICIES,
86
+ :message => _("must be one of the following: %s") % HTTP_PROXY_POLICIES.join(', ')
87
+ }
75
88
  scope :subscribable, -> { where(content_type: RootRepository::SUBSCRIBABLE_TYPES) }
76
89
  scope :has_url, -> { where.not(:url => nil) }
77
90
  scope :with_repository_attribute, ->(attr, value) { joins(:repositories).where("#{Katello::Repository.table_name}.#{attr}" => value) }
@@ -82,6 +95,13 @@ module Katello
82
95
  scope :puppet_type, -> { where(:content_type => Repository::PUPPET_TYPE) }
83
96
  scope :docker_type, -> { where(:content_type => Repository::DOCKER_TYPE) }
84
97
  scope :ostree_type, -> { where(:content_type => Repository::OSTREE_TYPE) }
98
+ scope :ansible_collection_type, -> { where(:content_type => Repository::ANSIBLE_COLLECTION_TYPE) }
99
+ scope :with_global_proxy, -> { where(:http_proxy_policy => RootRepository::GLOBAL_DEFAULT_HTTP_PROXY) }
100
+ scope :with_no_proxy, -> { where(:http_proxy_policy => RootRepository::NO_DEFAULT_HTTP_PROXY) }
101
+ scope :with_selected_proxy, ->(http_proxy_id) {
102
+ where(:http_proxy_policy => RootRepository::USE_SELECTED_HTTP_PROXY).
103
+ where("http_proxy_id = ?", http_proxy_id)
104
+ }
85
105
  delegate :redhat?, :provider, :organization, to: :product
86
106
 
87
107
  def library_instance
@@ -193,6 +213,10 @@ module Katello
193
213
  end
194
214
  end
195
215
 
216
+ def ensure_valid_ansible_collection_attributes
217
+ errors.add(:base, N_("Whitelist cannot be blank.")) if ansible_collection_whitelist.blank?
218
+ end
219
+
196
220
  def ensure_valid_upstream_authorization
197
221
  return if (self.upstream_username.blank? && self.upstream_password.blank?)
198
222
  if redhat?
@@ -247,6 +271,10 @@ module Katello
247
271
  self.content_type == Repository::DEB_TYPE
248
272
  end
249
273
 
274
+ def ansible_collection?
275
+ self.content_type == Repository::ANSIBLE_COLLECTION_TYPE
276
+ end
277
+
250
278
  def metadata_generate_needed?
251
279
  (%w(unprotected checksum_type container_repsoitory_name) & previous_changes.keys).any?
252
280
  end
@@ -258,9 +286,10 @@ module Katello
258
286
  def pulp_update_needed?
259
287
  changeable_attributes = %w(url unprotected checksum_type docker_upstream_name download_policy mirror_on_sync verify_ssl_on_sync
260
288
  upstream_username upstream_password ostree_upstream_sync_policy ostree_upstream_sync_depth ignore_global_proxy ignorable_content
261
- ssl_ca_cert_id ssl_client_cert_id ssl_client_key_id)
289
+ ssl_ca_cert_id ssl_client_cert_id ssl_client_key_id http_proxy_policy http_proxy_id)
262
290
  changeable_attributes += %w(name container_repository_name docker_tags_whitelist) if docker?
263
291
  changeable_attributes += %w(deb_releases deb_components deb_architectures gpg_key_id) if deb?
292
+ changeable_attributes += %w(ansible_collection_whitelist) if ansible_collection?
264
293
  changeable_attributes.any? { |key| previous_changes.key?(key) }
265
294
  end
266
295
 
@@ -268,16 +297,29 @@ module Katello
268
297
  self.content.content_url
269
298
  end
270
299
 
300
+ def repo_mapper
301
+ Katello::Candlepin::RepositoryMapper.new(self.product, self.content, self.substitutions)
302
+ end
303
+
271
304
  def calculate_updated_name
272
305
  fail _("Cannot calculate name for custom repos") if custom?
273
- Katello::Candlepin::RepositoryMapper.new(self.product, self.content, self.substitutions).name
306
+ repo_mapper.name
274
307
  end
275
308
 
276
309
  def substitutions
277
310
  {
278
311
  :releasever => self.minor,
279
312
  :basearch => self.arch
280
- }
313
+ }.compact
314
+ end
315
+
316
+ def http_proxy
317
+ if http_proxy_policy == NO_DEFAULT_HTTP_PROXY
318
+ return nil
319
+ elsif http_proxy_policy == GLOBAL_DEFAULT_HTTP_PROXY
320
+ return HttpProxy.default_global_content_proxy
321
+ end
322
+ super
281
323
  end
282
324
 
283
325
  class Jail < ::Safemode::Jail