katello 3.16.2 → 3.17.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 (381) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/katello/katello.scss +3 -7
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +8 -0
  5. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +10 -4
  6. data/app/controllers/katello/api/v2/host_tracer_controller.rb +33 -8
  7. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +11 -11
  8. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +0 -15
  9. data/app/controllers/katello/api/v2/repositories_controller.rb +5 -11
  10. data/app/controllers/katello/api/v2/upstream_subscriptions_controller.rb +16 -0
  11. data/app/controllers/katello/concerns/api/v2/bulk_hosts_extensions.rb +4 -4
  12. data/app/controllers/katello/concerns/api/v2/hostgroups_controller_extensions.rb +1 -1
  13. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +5 -11
  14. data/app/helpers/katello/concerns/dashboard_helper_extensions.rb +10 -0
  15. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +6 -7
  16. data/app/lib/actions/candlepin/product/content_add.rb +2 -1
  17. data/app/lib/actions/candlepin/product/content_update_enablement.rb +18 -0
  18. data/app/lib/actions/katello/applicability/hosts/bulk_generate.rb +2 -6
  19. data/app/lib/actions/katello/capsule_content/refresh_repos.rb +1 -1
  20. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  21. data/app/lib/actions/katello/capsule_content/sync_capsule.rb +3 -17
  22. data/app/lib/actions/katello/content_view_version/incremental_update.rb +2 -3
  23. data/app/lib/actions/katello/organization/simple_content_access/disable.rb +17 -0
  24. data/app/lib/actions/katello/organization/simple_content_access/enable.rb +17 -0
  25. data/app/lib/actions/katello/organization/simple_content_access/toggle.rb +36 -0
  26. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +13 -0
  27. data/app/lib/actions/katello/product/content_create.rb +3 -3
  28. data/app/lib/actions/katello/product/destroy.rb +4 -25
  29. data/app/lib/actions/katello/repository/content_update.rb +41 -0
  30. data/app/lib/actions/katello/repository/destroy.rb +1 -5
  31. data/app/lib/actions/katello/repository/export.rb +1 -1
  32. data/app/lib/actions/katello/repository/multi_clone_contents.rb +15 -13
  33. data/app/lib/actions/katello/repository/sync.rb +25 -35
  34. data/app/lib/actions/katello/repository/update.rb +19 -30
  35. data/app/lib/actions/katello/repository/update_cv_repo_cert_guard.rb +17 -0
  36. data/app/lib/actions/pulp/orchestration/repository/smart_proxy_sync.rb +1 -0
  37. data/app/lib/actions/pulp/orchestration/repository/sync.rb +1 -2
  38. data/app/lib/actions/pulp/repository/sync.rb +1 -2
  39. data/app/lib/actions/pulp3/abstract_async_task.rb +0 -1
  40. data/app/lib/actions/pulp3/capsule_content/sync.rb +1 -3
  41. data/app/lib/actions/pulp3/content_view/delete_repository_references.rb +1 -1
  42. data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +2 -1
  43. data/app/lib/actions/pulp3/orchestration/repository/sync.rb +1 -3
  44. data/app/lib/actions/pulp3/repository/copy_content.rb +1 -0
  45. data/app/lib/actions/pulp3/repository/delete.rb +1 -1
  46. data/app/lib/actions/pulp3/repository/multi_copy_content.rb +1 -1
  47. data/app/lib/actions/pulp3/repository/save_version.rb +16 -20
  48. data/app/lib/actions/pulp3/repository/sync.rb +1 -1
  49. data/app/lib/actions/pulp3/repository/update_cv_repository_cert_guard.rb +2 -6
  50. data/app/lib/actions/pulp3/repository/upload_file.rb +1 -1
  51. data/app/lib/katello/resources/candlepin/product.rb +11 -0
  52. data/app/lib/katello/resources/cdn.rb +2 -3
  53. data/app/lib/katello/util/cdn_var_substitutor.rb +7 -9
  54. data/app/lib/katello/validators/hostgroup_kickstart_repository_validator.rb +11 -11
  55. data/app/models/katello/activation_key.rb +1 -1
  56. data/app/models/katello/concerns/content_facet_host_extensions.rb +7 -0
  57. data/app/models/katello/concerns/host_managed_extensions.rb +39 -0
  58. data/app/models/katello/concerns/hostgroup_extensions.rb +46 -24
  59. data/app/models/katello/concerns/smart_proxy_extensions.rb +5 -19
  60. data/app/models/katello/concerns/widget_extensions.rb +23 -0
  61. data/app/models/katello/content_view.rb +9 -1
  62. data/app/models/katello/content_view_package_filter.rb +1 -1
  63. data/app/models/katello/content_view_version.rb +7 -0
  64. data/app/models/katello/erratum.rb +13 -0
  65. data/app/models/katello/erratum_cve.rb +8 -0
  66. data/app/models/katello/glue/pulp/repo.rb +1 -1
  67. data/app/models/katello/host/content_facet.rb +18 -1
  68. data/app/models/katello/host_collection.rb +6 -0
  69. data/app/models/katello/hostgroup/content_facet.rb +18 -0
  70. data/app/models/katello/installed_package.rb +8 -0
  71. data/app/models/katello/kt_environment.rb +9 -1
  72. data/app/models/katello/model.rb +16 -0
  73. data/app/models/katello/pool.rb +17 -0
  74. data/app/models/katello/product.rb +6 -0
  75. data/app/models/katello/purpose_addons_status.rb +1 -0
  76. data/app/models/katello/purpose_role_status.rb +1 -0
  77. data/app/models/katello/purpose_sla_status.rb +1 -0
  78. data/app/models/katello/purpose_usage_status.rb +1 -0
  79. data/app/models/katello/repository.rb +3 -6
  80. data/app/models/katello/root_repository.rb +24 -16
  81. data/app/models/katello/subscription_status.rb +1 -1
  82. data/app/models/katello/trace_status.rb +1 -1
  83. data/app/models/setting/content.rb +6 -2
  84. data/app/services/cert/certs.rb +2 -10
  85. data/app/services/katello/event_daemon.rb +7 -8
  86. data/app/services/katello/host_status_manager.rb +13 -0
  87. data/app/services/katello/pulp3/migration.rb +1 -1
  88. data/app/services/katello/pulp3/repository/yum.rb +6 -72
  89. data/app/services/katello/pulp3/repository.rb +11 -10
  90. data/app/services/katello/pulp3/smart_proxy_mirror_repository.rb +1 -1
  91. data/app/services/katello/pulp3/task.rb +3 -3
  92. data/app/services/katello/pulp3/task_group.rb +0 -6
  93. data/app/services/katello/smart_proxy_helper.rb +16 -13
  94. data/app/views/foreman/smart_proxies/_content_sync.html.erb +1 -1
  95. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  96. data/config/routes/api/rhsm.rb +0 -1
  97. data/config/routes/api/v2.rb +8 -2
  98. data/config/routes/overrides.rb +0 -4
  99. data/db/migrate/20141222151001_add_host_content_view_environment.rb +1 -1
  100. data/db/migrate/20180904122343_create_hostgroup_content_facet.katello.rb +16 -0
  101. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +53 -0
  102. data/db/migrate/20200610112009_remove_audits_of_root_repo_with_content_id.rb +9 -0
  103. data/db/migrate/20200701150946_add_auto_enabled_to_root_repository.rb +5 -0
  104. data/db/seeds.d/75-job_templates.rb +2 -2
  105. data/engines/bastion/app/assets/javascripts/bastion/components/nutupane.factory.js +3 -1
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +5 -2
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-details.controller.js +4 -2
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-add-subscriptions.html +1 -1
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +2 -2
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +1 -1
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +4 -1
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +4 -1
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-subscriptions-modal.controller.js +1 -0
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-traces-modal.controller.js +4 -3
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-environment-modal.html +7 -1
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +1 -0
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +1 -0
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +4 -2
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js +1 -1
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +7 -1
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +4 -2
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-add-subscriptions.html +1 -1
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +1 -0
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +14 -6
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions-list.html +1 -1
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +6 -6
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +5 -2
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +1 -1
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +1 -2
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-traces-resolve.factory.js +18 -0
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +45 -4
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/de.po +1 -1
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/es.po +1 -1
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/fr.po +1 -1
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/it.po +1 -1
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ja.po +1 -1
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ko.po +1 -1
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/pt_BR.po +1 -1
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/ru.po +1 -1
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_CN.po +1 -1
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/locale/zh_TW.po +1 -1
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/product-bulk-action.factory.js +0 -1
  143. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details.controller.js +0 -6
  144. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +1 -7
  145. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +11 -1
  146. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +1 -1
  147. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +16 -4
  148. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repository.factory.js +0 -1
  149. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +0 -15
  150. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +0 -6
  151. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +1 -1
  152. data/lib/katello/engine.rb +6 -5
  153. data/lib/katello/permission_creator.rb +3 -3
  154. data/lib/katello/permissions/host_permissions.rb +0 -1
  155. data/lib/katello/plugin.rb +20 -16
  156. data/lib/katello/tasks/pulp3_post_migration_check.rake +1 -2
  157. data/lib/katello/tasks/reimport.rake +1 -1
  158. data/lib/katello/tasks/reports.rake +0 -12
  159. data/lib/katello/tasks/test.rake +15 -0
  160. data/lib/katello/version.rb +1 -1
  161. data/locale/action_names.rb +48 -48
  162. data/locale/bn/katello.po +137 -14
  163. data/locale/cs/katello.po +137 -14
  164. data/locale/de/katello.po +138 -15
  165. data/locale/en/katello.po +137 -14
  166. data/locale/es/katello.po +138 -15
  167. data/locale/fr/katello.po +138 -15
  168. data/locale/gu/katello.po +137 -14
  169. data/locale/hi/katello.po +137 -14
  170. data/locale/it/katello.po +138 -15
  171. data/locale/ja/katello.po +138 -15
  172. data/locale/katello.pot +969 -769
  173. data/locale/kn/katello.po +137 -14
  174. data/locale/ko/katello.po +138 -15
  175. data/locale/mr/katello.po +137 -14
  176. data/locale/or/katello.po +137 -14
  177. data/locale/pa/katello.po +137 -14
  178. data/locale/pt/katello.po +137 -14
  179. data/locale/pt_BR/katello.po +138 -15
  180. data/locale/ru/katello.po +138 -15
  181. data/locale/ta/katello.po +137 -14
  182. data/locale/te/katello.po +137 -14
  183. data/locale/zh_CN/katello.po +138 -15
  184. data/locale/zh_TW/katello.po +138 -15
  185. data/package.json +8 -25
  186. data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +3 -0
  187. data/webpack/components/ActionableDetail.js +63 -0
  188. data/webpack/components/Content/ContentTable.js +2 -2
  189. data/webpack/components/Content/Details/ContentDetailRepositoryTableSchema.js +1 -1
  190. data/webpack/components/Content/Details/ContentDetails.js +1 -1
  191. data/webpack/components/Content/__tests__/ContentTable.test.js +2 -2
  192. data/webpack/components/Content/__tests__/__snapshots__/ContentPage.test.js.snap +1 -1
  193. data/webpack/components/EditableSwitch.js +30 -0
  194. data/webpack/components/EditableTextInput/EditableTextInput.js +120 -0
  195. data/webpack/components/EditableTextInput/__tests__/editableTextInput.test.js +52 -0
  196. data/webpack/components/EditableTextInput/editableTextInput.scss +14 -0
  197. data/webpack/components/EditableTextInput/index.js +3 -0
  198. data/webpack/{scenes/ContentViews/components → components}/Loading.js +8 -5
  199. data/webpack/{move_to_pf → components}/LoadingState/LoadingState.js +0 -0
  200. data/webpack/{move_to_pf → components}/LoadingState/LoadingState.scss +0 -0
  201. data/webpack/{move_to_pf → components}/LoadingState/LoadingState.test.js +0 -0
  202. data/webpack/{move_to_pf → components}/LoadingState/__snapshots__/LoadingState.test.js.snap +0 -0
  203. data/webpack/{move_to_pf → components}/LoadingState/index.js +0 -0
  204. data/webpack/components/MultiSelect/index.js +1 -1
  205. data/webpack/{move_to_pf → components}/OptionTooltip/OptionTooltip.scss +0 -0
  206. data/webpack/{move_to_pf → components}/OptionTooltip/__tests__/OptionTooltip.test.js +0 -0
  207. data/webpack/{move_to_pf → components}/OptionTooltip/__tests__/__snapshots__/OptionTooltip.test.js.snap +0 -0
  208. data/webpack/{move_to_pf → components}/OptionTooltip/index.js +0 -0
  209. data/webpack/components/Search/Search.js +124 -0
  210. data/webpack/components/Search/Search.test.js +2 -1
  211. data/webpack/components/Search/__snapshots__/Search.test.js.snap +2 -0
  212. data/webpack/components/Search/__tests__/search.test.js +124 -0
  213. data/webpack/components/Search/index.js +11 -87
  214. data/webpack/{move_to_pf → components}/Select/Select.js +0 -0
  215. data/webpack/components/SelectOrg/SetOrganization.js +2 -2
  216. data/webpack/components/TabWrapper/TabWrapper.js +26 -0
  217. data/webpack/components/TabWrapper/index.js +3 -0
  218. data/webpack/components/TabbedView/TabbedView.js +38 -0
  219. data/webpack/components/TabbedView/TabbedView.scss +3 -0
  220. data/webpack/components/TabbedView/index.js +3 -0
  221. data/webpack/components/Table/EmptyStateMessage.js +61 -0
  222. data/webpack/{scenes/ContentViews/Table/TableWrapper.js → components/Table/MainTable.js} +23 -12
  223. data/webpack/components/Table/TableWrapper.js +94 -0
  224. data/webpack/{move_to_pf → components}/TooltipButton/TooltipButton.js +0 -0
  225. data/webpack/{move_to_pf → components}/TooltipButton/TooltipButton.scss +0 -0
  226. data/webpack/{move_to_pf → components}/TooltipButton/TooltipButton.test.js +0 -0
  227. data/webpack/{move_to_pf → components}/TooltipButton/__snapshots__/TooltipButton.test.js.snap +0 -0
  228. data/webpack/{move_to_pf → components}/TooltipButton/index.js +0 -0
  229. data/webpack/components/TypeAhead/TypeAhead.js +109 -0
  230. data/webpack/{move_to_pf → components}/TypeAhead/TypeAhead.scss +0 -0
  231. data/webpack/components/TypeAhead/helpers/commonPropTypes.js +35 -0
  232. data/webpack/components/TypeAhead/helpers/helpers.js +32 -0
  233. data/webpack/components/TypeAhead/index.js +3 -0
  234. data/webpack/{move_to_pf/TypeAhead → components/TypeAhead/pf3Search}/TypeAheadInput.js +3 -6
  235. data/webpack/{move_to_pf/TypeAhead → components/TypeAhead/pf3Search}/TypeAheadItems.js +3 -7
  236. data/webpack/components/TypeAhead/pf3Search/TypeAheadSearch.js +52 -0
  237. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.js +44 -0
  238. data/webpack/components/TypeAhead/pf4Search/TypeAheadInput.scss +11 -0
  239. data/webpack/components/TypeAhead/pf4Search/TypeAheadItems.js +57 -0
  240. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.js +66 -0
  241. data/webpack/components/TypeAhead/pf4Search/TypeAheadSearch.scss +5 -0
  242. data/webpack/components/extensions/about/__tests__/SystemStatuses.test.js +1 -1
  243. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/CollapseSubscriptionGroupButton.js +0 -0
  244. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/CollapseSubscriptionGroupButton.test.js +0 -0
  245. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/Table.js +0 -0
  246. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/Table.test.js +0 -0
  247. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBody.js +0 -0
  248. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBody.test.js +0 -0
  249. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBodyMessage.js +0 -0
  250. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableBodyMessage.test.js +0 -0
  251. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableFixtures.js +0 -0
  252. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionCell.js +0 -0
  253. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionCell.test.js +0 -0
  254. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionHeaderCell.js +0 -0
  255. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/TableSelectionHeaderCell.test.js +0 -0
  256. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/CollapseSubscriptionGroupButton.test.js.snap +0 -0
  257. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/Table.test.js.snap +0 -0
  258. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableBody.test.js.snap +0 -0
  259. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableBodyMessage.test.js.snap +0 -0
  260. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableSelectionCell.test.js.snap +0 -0
  261. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/__snapshots__/TableSelectionHeaderCell.test.js.snap +0 -0
  262. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/components/index.js +0 -0
  263. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/EntitlementsInlineEditFormatter.js +1 -1
  264. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/__tests__/EntitlementsInlineEditFormatter.test.js +0 -0
  265. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/__tests__/__snapshots__/EntitlementsInlineEditFormatter.test.js.snap +0 -0
  266. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/cellFormatter.js +0 -0
  267. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/collapseableAndSelectionCellFormatter.js +0 -0
  268. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/ellipsisCellFormatter.js +0 -0
  269. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/headerFormatter.js +0 -0
  270. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/index.js +0 -0
  271. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/selectionCellFormatter.js +0 -0
  272. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/formatters/selectionHeaderCellFormatter.js +0 -0
  273. data/webpack/{move_to_foreman/components/common/table → components/pf3Table}/index.js +0 -0
  274. data/webpack/{move_to_pf → components}/react-bootstrap-select/index.js +0 -0
  275. data/webpack/containers/Application/config.js +5 -0
  276. data/webpack/containers/Application/overrides.scss +5 -0
  277. data/webpack/global_test_setup.js +3 -1
  278. data/webpack/redux/OrganizationProducts/OrganizationProductsActions.js +1 -1
  279. data/webpack/redux/OrganizationProducts/__tests__/OrganizationProductsActions.test.js +2 -2
  280. data/webpack/redux/actions/RedHatRepositories/enabled.js +1 -1
  281. data/webpack/redux/actions/RedHatRepositories/helpers.js +1 -1
  282. data/webpack/redux/actions/RedHatRepositories/repositorySetRepositories.js +1 -1
  283. data/webpack/redux/reducers/index.js +2 -0
  284. data/webpack/scenes/AnsibleCollections/AnsibleCollectionsActions.js +1 -1
  285. data/webpack/scenes/AnsibleCollections/AnsibleCollectionsTableSchema.js +1 -1
  286. data/webpack/scenes/AnsibleCollections/Details/AnsibleCollectionDetailsActions.js +1 -1
  287. data/webpack/scenes/AnsibleCollections/Details/__tests__/AnsibleCollectionDetailsActions.test.js +2 -2
  288. data/webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsTable.test.js +1 -1
  289. data/webpack/scenes/ContentViews/ContentViewSelectors.js +1 -2
  290. data/webpack/scenes/ContentViews/ContentViewsActions.js +4 -4
  291. data/webpack/scenes/ContentViews/ContentViewsConstants.js +4 -1
  292. data/webpack/scenes/ContentViews/ContentViewsPage.js +12 -6
  293. data/webpack/scenes/ContentViews/Details/ContentViewDetailActions.js +44 -0
  294. data/webpack/scenes/ContentViews/Details/ContentViewDetailReducer.js +23 -0
  295. data/webpack/scenes/ContentViews/{details → Details}/ContentViewDetailSelectors.js +3 -0
  296. data/webpack/scenes/ContentViews/Details/ContentViewDetails.js +70 -0
  297. data/webpack/scenes/ContentViews/Details/ContentViewInfo.js +116 -0
  298. data/webpack/scenes/ContentViews/{details → Details}/DetailsContainer.js +8 -4
  299. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetail.test.js +101 -0
  300. data/webpack/scenes/ContentViews/Details/__tests__/contentViewDetails.fixtures.json +106 -0
  301. data/webpack/scenes/ContentViews/Details/contentViewInfo.scss +8 -0
  302. data/webpack/scenes/ContentViews/Details/index.js +7 -0
  303. data/webpack/scenes/ContentViews/Table/ContentViewsTable.js +51 -36
  304. data/webpack/scenes/ContentViews/Table/tableDataGenerator.js +47 -44
  305. data/webpack/scenes/ContentViews/__tests__/basicContentViews.fixtures.js +31 -0
  306. data/webpack/scenes/ContentViews/__tests__/contentViewList.fixtures.json +2 -1
  307. data/webpack/scenes/ContentViews/__tests__/contentViewPage.test.js +173 -23
  308. data/webpack/scenes/ContentViews/components/ContentViewIcon.js +26 -0
  309. data/webpack/scenes/ContentViews/components/{contentViewName.scss → contentViewIcon.scss} +0 -0
  310. data/webpack/scenes/ModuleStreams/Details/ModuleStreamDetailsActions.js +1 -1
  311. data/webpack/scenes/ModuleStreams/Details/Profiles/TableSchema.js +1 -1
  312. data/webpack/scenes/ModuleStreams/Details/__tests__/ModuleStreamDetailsActions.test.js +2 -2
  313. data/webpack/scenes/ModuleStreams/ModuleStreamsActions.js +1 -1
  314. data/webpack/scenes/ModuleStreams/ModuleStreamsTableSchema.js +1 -1
  315. data/webpack/scenes/ModuleStreams/__tests__/ModuleStreamsTable.test.js +1 -1
  316. data/webpack/scenes/Organizations/OrganizationSelectors.js +14 -0
  317. data/webpack/scenes/Products/ProductActions.js +1 -1
  318. data/webpack/scenes/RedHatRepositories/RedHatRepositoriesPage.js +1 -1
  319. data/webpack/scenes/Settings/SettingsConstants.js +3 -0
  320. data/webpack/scenes/Settings/SettingsReducer.js +33 -0
  321. data/webpack/scenes/Settings/SettingsSelectors.js +4 -0
  322. data/webpack/scenes/Settings/index.js +2 -1
  323. data/webpack/scenes/Subscriptions/Details/SubscriptionDetailActions.js +1 -1
  324. data/webpack/scenes/Subscriptions/Details/SubscriptionDetails.js +1 -1
  325. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.js +59 -73
  326. data/webpack/scenes/Subscriptions/Manifest/ManageManifestModal.scss +15 -0
  327. data/webpack/scenes/Subscriptions/Manifest/ManifestActions.js +43 -1
  328. data/webpack/scenes/Subscriptions/Manifest/ManifestConstants.js +8 -0
  329. data/webpack/scenes/Subscriptions/Manifest/ManifestHistoryTableSchema.js +1 -1
  330. data/webpack/scenes/Subscriptions/Manifest/SimpleContentAccess.js +78 -0
  331. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManageManifestModal.test.js +2 -0
  332. data/webpack/scenes/Subscriptions/Manifest/__tests__/ManifestActions.test.js +56 -1
  333. data/webpack/scenes/Subscriptions/Manifest/__tests__/SimpleContentAccess.test.js +114 -0
  334. data/webpack/scenes/Subscriptions/Manifest/__tests__/__snapshots__/ManageManifestModal.test.js.snap +6 -6
  335. data/webpack/scenes/Subscriptions/Manifest/__tests__/manifest.fixtures.js +36 -0
  336. data/webpack/scenes/Subscriptions/Manifest/index.js +3 -1
  337. data/webpack/scenes/Subscriptions/SubscriptionActions.js +1 -1
  338. data/webpack/scenes/Subscriptions/SubscriptionConstants.js +4 -0
  339. data/webpack/scenes/Subscriptions/SubscriptionHelpers.js +0 -3
  340. data/webpack/scenes/Subscriptions/SubscriptionReducer.js +38 -11
  341. data/webpack/scenes/Subscriptions/SubscriptionsPage.js +30 -18
  342. data/webpack/scenes/Subscriptions/SubscriptionsSelectors.js +0 -3
  343. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js +1 -1
  344. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsPage.js +2 -2
  345. data/webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsTableSchema.js +1 -1
  346. data/webpack/scenes/Subscriptions/__tests__/SubscriptionHelpers.test.js +0 -11
  347. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsActions.test.js.snap +2 -2
  348. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsPage.test.js.snap +4 -4
  349. data/webpack/scenes/Subscriptions/__tests__/__snapshots__/SubscriptionsReducer.test.js.snap +26 -1
  350. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionTypeFormatter.js +2 -2
  351. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTable.js +27 -21
  352. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableHelpers.js +6 -2
  353. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/SubscriptionsTableSchema.js +2 -2
  354. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/__tests__/__snapshots__/SubscriptionTypeFormatter.test.js.snap +3 -3
  355. data/webpack/scenes/Subscriptions/components/SubscriptionsTable/components/Table.js +1 -1
  356. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/SubscriptionsToolbar.js +28 -3
  357. data/webpack/scenes/Subscriptions/components/SubscriptionsToolbar/__snapshots__/SubscriptionsToolbar.test.js.snap +5 -10
  358. data/webpack/scenes/Subscriptions/index.js +6 -2
  359. data/webpack/test-utils/nockWrapper.js +39 -5
  360. data/webpack/test-utils/react-testing-lib-wrapper.js +35 -9
  361. data/webpack/{move_to_foreman/common → utils}/helpers.js +12 -8
  362. data/webpack/utils/useEventListener.js +37 -0
  363. metadata +143 -83
  364. data/app/lib/actions/katello/repository/verify_checksum.rb +0 -28
  365. data/app/lib/actions/pulp3/orchestration/repository/trigger_update_repo_cert_guard.rb +0 -22
  366. data/app/lib/actions/pulp3/repository/presenters/repair_presenter.rb +0 -85
  367. data/app/lib/actions/pulp3/repository/repair.rb +0 -29
  368. data/app/services/katello/host_trace_manager.rb +0 -38
  369. data/vendor/assets/stylesheets/katello/jquery.loadmask.css.scss +0 -40
  370. data/vendor/assets/stylesheets/katello/ui.spinner.css.scss +0 -3
  371. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +0 -2
  372. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalSelectors.js +0 -2
  373. data/webpack/__mocks__/foremanReact/components/ForemanModal/index.js +0 -4
  374. data/webpack/__mocks__/foremanReact/components/Settings/SettingsActions.js +0 -4
  375. data/webpack/__mocks__/foremanReact/components/Settings/SettingsConstants.js +0 -2
  376. data/webpack/move_to_pf/TypeAhead/TypeAhead.js +0 -138
  377. data/webpack/move_to_pf/TypeAhead/helpers.js +0 -5
  378. data/webpack/scenes/ContentViews/components/ContentViewName.js +0 -33
  379. data/webpack/scenes/ContentViews/components/EmptyStateMessage.js +0 -43
  380. data/webpack/scenes/ContentViews/details/ContentViewDetailActions.js +0 -12
  381. data/webpack/scenes/ContentViews/expansions/RepositoriesExpansion.js +0 -12
@@ -25,7 +25,7 @@ module Actions
25
25
  filechunk.flush
26
26
  actual_chunk_size = File.size(filechunk)
27
27
  response = uploads_api.update(upload_href, content_range(offset, offset + actual_chunk_size - 1, total_size), filechunk)
28
- offset += actual_chunk_size
28
+ offset += actual_chunk_size - 1
29
29
  ensure
30
30
  filechunk.close
31
31
  filechunk.unlink
@@ -66,6 +66,17 @@ module Katello
66
66
  self.post(join_path(path(owner_label, product_id), "content/#{content_id}?enabled=#{enabled}"), nil, self.default_headers).code.to_i
67
67
  end
68
68
 
69
+ def update_enabled(owner_label, product_id, contents)
70
+ options = { id: product_id }
71
+ options[:productContent] = contents.map do |content|
72
+ ret = { content: { id: content[:id] } }
73
+ ret[:enabled] = content[:enabled] if content.key?(:enabled)
74
+ ret
75
+ end
76
+
77
+ update(owner_label, options)
78
+ end
79
+
69
80
  def remove_content(owner_label, product_id, content_id)
70
81
  self.delete(join_path(path(owner_label, product_id), "content/#{content_id}"), self.default_headers).code.to_i
71
82
  end
@@ -18,7 +18,7 @@ module Katello
18
18
  class CdnResource
19
19
  CDN_DOCKER_CONTAINER_LISTING = "CONTAINER_REGISTRY_LISTING".freeze
20
20
 
21
- attr_reader :url, :product, :options, :proxy
21
+ attr_reader :url, :product, :options
22
22
 
23
23
  def substitutor(logger = nil)
24
24
  @logger = logger
@@ -26,7 +26,6 @@ module Katello
26
26
  end
27
27
 
28
28
  def initialize(url, options = {})
29
- @proxy = ::HttpProxy.default_global_content_proxy
30
29
  @ssl_version = Setting[:cdn_ssl_version]
31
30
  if @ssl_version && !SUPPORTED_SSL_VERSIONS.include?(@ssl_version)
32
31
  fail("Invalid SSL version specified. Check the 'CDN SSL Version' setting")
@@ -141,7 +140,7 @@ module Katello
141
140
  end
142
141
 
143
142
  def net_http_class
144
- if self.proxy
143
+ if (proxy = ::HttpProxy.default_global_content_proxy)
145
144
  uri = URI(proxy.url) #Net::HTTP::Proxy ignores port as part of the url
146
145
  Net::HTTP::Proxy("#{uri.host}#{uri.path}", uri.port, proxy.username, proxy.password)
147
146
  else
@@ -59,17 +59,15 @@ module Katello
59
59
 
60
60
  return resolved if to_resolve.empty?
61
61
 
62
- to_resolve.in_groups_of(8) do |group|
63
- futures = group.map do |path_with_substitution|
64
- Concurrent::Promises.future do
65
- path_with_substitution.resolve_substitutions(@resource)
66
- end
62
+ futures = to_resolve.map do |path_with_substitution|
63
+ Concurrent::Promises.future do
64
+ path_with_substitution.resolve_substitutions(@resource)
67
65
  end
66
+ end
68
67
 
69
- futures.each do |future|
70
- resolved << future.value
71
- Rails.logger.error("Failed at scanning for repository: #{future.reason}") if future.rejected?
72
- end
68
+ futures.each do |future|
69
+ resolved << future.value
70
+ Rails.logger.error("Failed at scanning for repository: #{future.reason}") if future.rejected?
73
71
  end
74
72
 
75
73
  find_substitutions(resolved.compact.flatten)
@@ -1,29 +1,29 @@
1
1
  module Katello
2
2
  module Validators
3
3
  class HostgroupKickstartRepositoryValidator < ActiveModel::Validator
4
- def validate(hostgroup)
4
+ def validate(facet)
5
5
  # check content source first, otherwise it's meaningless to proceed
6
- if hostgroup.content_source && hostgroup.lifecycle_environment
7
- valid = hostgroup.content_source.lifecycle_environments.include?(hostgroup.lifecycle_environment)
8
- hostgroup.errors.add(:base, _("The selected content source and lifecycle environment do not match")) && return unless valid
6
+ if facet.content_source && facet.lifecycle_environment
7
+ valid = facet.content_source.lifecycle_environments.include?(facet.lifecycle_environment)
8
+ facet.errors.add(:base, _("The selected content source and lifecycle environment do not match")) && return unless valid
9
9
  end
10
10
 
11
- return unless hostgroup.kickstart_repository_id
11
+ return unless facet.kickstart_repository_id
12
12
 
13
- msg = if hostgroup.content_source.blank?
13
+ msg = if facet.content_source.blank?
14
14
  _("Please select a content source before assigning a kickstart repository")
15
- elsif hostgroup.operatingsystem.blank?
15
+ elsif facet.hostgroup.operatingsystem.blank?
16
16
  _("Please select an operating system before assigning a kickstart repository")
17
- elsif !hostgroup.operatingsystem.is_a?(Redhat)
17
+ elsif !facet.hostgroup.operatingsystem.is_a?(Redhat)
18
18
  _("Kickstart repositories can only be assigned to hosts in the Red Hat family")
19
- elsif hostgroup.architecture.blank?
19
+ elsif facet.hostgroup.architecture.blank?
20
20
  _("Please select an architecture before assigning a kickstart repository")
21
- elsif !hostgroup.matching_kickstart_repository?
21
+ elsif !facet.hostgroup.matching_kickstart_repository?(facet)
22
22
  _("The selected kickstart repository is not part of the assigned content view, lifecycle environment,
23
23
  content source, operating system, and architecture")
24
24
  end
25
25
 
26
- hostgroup.errors.add(:base, msg) if msg
26
+ facet.errors.add(:base, msg) if msg
27
27
  end
28
28
  end
29
29
  end
@@ -104,7 +104,7 @@ module Katello
104
104
  end
105
105
 
106
106
  def products
107
- Katello::Product.joins(:pools => :activation_keys).where("#{Katello::ActivationKey.table_name}.id" => self.id).enabled.uniq
107
+ Katello::Product.distinct.joins(:pools => :activation_keys).where("#{Katello::ActivationKey.table_name}.id" => self.id).enabled.sort
108
108
  end
109
109
 
110
110
  def valid_content_override_label?(content_label)
@@ -57,6 +57,13 @@ module Katello
57
57
  attributes['lifecycle_environment_id'].blank?
58
58
  )
59
59
  end
60
+
61
+ apipie :class do
62
+ property :content_view, 'ContentView', desc: 'Returns content view associated with the host'
63
+ property :lifecycle_environment, 'KTEnvironment', desc: 'Returns lifecycle environment object associated with the host'
64
+ property :content_source, 'SmartProxy', desc: 'Returns Smart Proxy object as the content source for the host'
65
+ property :applicable_errata, array_of: 'Erratum', desc: 'Returns Smart Proxy object as the content source for the host'
66
+ end
60
67
  end
61
68
 
62
69
  module ClassMethods
@@ -52,6 +52,9 @@ module Katello
52
52
  before_validation :correct_kickstart_repository
53
53
  before_update :check_host_registration, :if => proc { organization_id_changed? }
54
54
 
55
+ after_validation :queue_reset_content_host_status
56
+ register_rebuild(:queue_reset_content_host_status, N_("Content_Host_Status"))
57
+
55
58
  scope :with_pools_expiring_in_days, ->(days) { joins(:pools).merge(Katello::Pool.expiring_in_days(days)).distinct }
56
59
 
57
60
  scoped_search :relation => :host_collections, :on => :id, :complete_value => false, :rename => :host_collection_id, :only_explicit => true, :validator => ScopedSearch::Validators::INTEGER
@@ -75,6 +78,19 @@ module Katello
75
78
  { :conditions => "1=0" }
76
79
  end
77
80
  end
81
+
82
+ apipie :class do
83
+ property :content_source, 'SmartProxy', desc: 'Returns Smart Proxy object as the content source for the host'
84
+ property :subscription_manager_configuration_url, String, desc: 'Returns URL for subscription manager configuration'
85
+ property :rhsm_organization_label, String, desc: 'Returns label of the Red Hat Subscription Manager organization'
86
+ property :host_collections, array_of: 'HostCollection', desc: 'Returns list of the host collections the host belongs to'
87
+ property :comment, String, desc: 'Returns comment given to the host'
88
+ property :pools, array_of: 'Pool', desc: 'Returns subscription pool objects associated with the host'
89
+ property :hypervisor_host, 'Host', desc: 'Returns hypervisor host object of this host'
90
+ property :lifecycle_environment, 'KTEnvironment', desc: 'Returns lifecycle environment object associated with the host'
91
+ property :content_view, 'ContentView', desc: 'Returns content view associated with the host'
92
+ property :installed_packages, array_of: 'InstalledPackage', desc: 'Returns a list of packages installed on the host'
93
+ end
78
94
  end
79
95
 
80
96
  def check_host_registration
@@ -83,6 +99,29 @@ module Katello
83
99
  end
84
100
  end
85
101
 
102
+ def reset_katello_status
103
+ self.host_statuses.where(type: ::Katello::HostStatusManager::STATUSES.map(&:name)).each do |status|
104
+ status.update!(:status => status.class.const_get(:UNKNOWN))
105
+ end
106
+ self.host_statuses.reload
107
+ true
108
+ end
109
+
110
+ def reset_content_host_status
111
+ logger.debug "Scheduling host status cleanup"
112
+ queue.create(id: "reset_content_host_status_#{id}", name: _("Mark Content Host Statuses as Unknown for %s") % self,
113
+ priority: 200, action: [self, :reset_katello_status])
114
+ end
115
+
116
+ def queue_reset_content_host_status
117
+ should_reset_content_host_status? && reset_content_host_status
118
+ end
119
+
120
+ def should_reset_content_host_status?
121
+ return false unless self.is_a?(::Host::Base)
122
+ !new_record? && build && self.changes.key?('build')
123
+ end
124
+
86
125
  def correct_kickstart_repository
87
126
  return unless content_facet
88
127
 
@@ -5,35 +5,43 @@ module Katello
5
5
 
6
6
  included do
7
7
  before_save :add_organization_for_environment
8
- belongs_to :kickstart_repository, :class_name => "::Katello::Repository",
9
- :foreign_key => :kickstart_repository_id, :inverse_of => :kickstart_hostgroups
10
- belongs_to :content_source, :class_name => "::SmartProxy", :foreign_key => :content_source_id, :inverse_of => :hostgroups
11
- belongs_to :content_view, :inverse_of => :hostgroups, :class_name => "::Katello::ContentView"
12
- belongs_to :lifecycle_environment, :inverse_of => :hostgroups, :class_name => "::Katello::KTEnvironment"
13
8
 
14
- validates_with Katello::Validators::ContentViewEnvironmentValidator
15
- validates_with Katello::Validators::HostgroupKickstartRepositoryValidator
16
- validates_with ::AssociationExistsValidator, attributes: [:content_source]
9
+ has_one :kickstart_repository, :through => :content_facet
10
+ has_one :content_source, :through => :content_facet
11
+ has_one :content_view, :through => :content_facet
12
+ has_one :lifecycle_environment, :through => :content_facet
17
13
 
18
14
  scoped_search :relation => :content_source, :on => :name, :complete_value => true, :rename => :content_source, :only_explicit => true
19
15
  scoped_search :relation => :content_view, :on => :name, :complete_value => true, :rename => :content_view, :only_explicit => true
20
16
  scoped_search :relation => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment, :only_explicit => true
21
17
 
22
18
  before_validation :correct_kickstart_repository
19
+
20
+ delegate :content_source_name, :content_view_name, :lifecycle_environment_name, to: :content_facet, allow_nil: true
21
+ delegate :content_source_id, :content_view_id, :lifecycle_environment_id, :kickstart_repository_id, to: :content_facet, allow_nil: true
22
+ delegate :'content_source_id=', :'content_view_id=', :'lifecycle_environment_id=', :'kickstart_repository_id=', to: :safe_content_facet, allow_nil: true
23
+
24
+ apipie :class do
25
+ property :content_source, 'SmartProxy', desc: 'Returns Smart Proxy object as the content source for the host group'
26
+ property :subscription_manager_configuration_url, String, desc: 'Returns URL for subscription manager configuration'
27
+ property :rhsm_organization_label, String, desc: 'Returns label of the Red Hat Subscription Manager organization'
28
+ end
23
29
  end
24
30
 
25
31
  def correct_kickstart_repository
26
32
  # If switched from ks repo to install media:
27
- if medium_id_changed? && medium && kickstart_repository_id
28
- self.kickstart_repository_id = nil
33
+ if medium_id_changed? && medium && content_facet&.kickstart_repository_id
34
+ # since it's :through association, nullify both the actual data source and delegate
35
+ self.content_facet.kickstart_repository = nil
36
+ self.kickstart_repository = nil
29
37
  # If switched from install media to ks repo:
30
- elsif kickstart_repository && medium
38
+ elsif content_facet&.kickstart_repository && medium
31
39
  self.medium = nil
32
40
  end
33
41
 
34
- unless matching_kickstart_repository?
42
+ unless matching_kickstart_repository?(content_facet)
35
43
  if (equivalent = equivalent_kickstart_repository)
36
- self.kickstart_repository_id = equivalent[:id]
44
+ self.content_facet.kickstart_repository_id = equivalent[:id]
37
45
  end
38
46
  end
39
47
  end
@@ -55,19 +63,19 @@ module Katello
55
63
  end
56
64
 
57
65
  def inherited_content_source_id
58
- inherited_ancestry_attribute(:content_source_id)
66
+ inherited_ancestry_attribute(:content_source_id, :content_facet)
59
67
  end
60
68
 
61
69
  def inherited_content_view_id
62
- inherited_ancestry_attribute(:content_view_id)
70
+ inherited_ancestry_attribute(:content_view_id, :content_facet)
63
71
  end
64
72
 
65
73
  def inherited_lifecycle_environment_id
66
- inherited_ancestry_attribute(:lifecycle_environment_id)
74
+ inherited_ancestry_attribute(:lifecycle_environment_id, :content_facet)
67
75
  end
68
76
 
69
77
  def inherited_kickstart_repository_id
70
- inherited_ancestry_attribute(:kickstart_repository_id)
78
+ inherited_ancestry_attribute(:kickstart_repository_id, :content_facet)
71
79
  end
72
80
 
73
81
  def rhsm_organization_label
@@ -95,22 +103,36 @@ module Katello
95
103
  ks_repos.find { |repo| repo[:name] == kickstart_repository.label }
96
104
  end
97
105
 
98
- def matching_kickstart_repository?
106
+ def matching_kickstart_repository?(content_facet)
99
107
  return true unless operatingsystem
100
108
 
101
109
  if operatingsystem.respond_to? :kickstart_repos
102
- return operatingsystem.kickstart_repos(self).any? { |repo| repo[:id] == kickstart_repository_id }
110
+ return operatingsystem.kickstart_repos(self).any? { |repo| repo[:id] == (content_facet&.kickstart_repository_id || content_facet&.kickstart_repository&.id) }
103
111
  end
104
112
  end
105
113
 
106
114
  private
107
115
 
108
- def inherited_ancestry_attribute(attribute)
109
- if ancestry.present?
110
- self[attribute] || self.class.sort_by_ancestry(ancestors.where("#{attribute.to_s} is not NULL")).last.try(attribute)
111
- else
112
- self.send(attribute)
116
+ def inherited_ancestry_attribute(attribute, facet)
117
+ value = self.send(facet)&.send(attribute)
118
+
119
+ if value.nil? && ancestry.present?
120
+ # take first non-null value for the attribute going up the ancestry tree.
121
+ # example: you have hg1 -> hg11 -> hg111 -> hg1111 hostgroups.
122
+ # given we are querying hg1111 (the leaf), and a value is set on:
123
+ # hg1: 1
124
+ # hg11: 2
125
+ # it will return the value 2.
126
+ facet_model = Facets.registered_facets[facet].hostgroup_configuration.model
127
+ value = facet_model.where.not(attribute => nil).joins(:hostgroup).merge(
128
+ ::Hostgroup.where(id: self.ancestor_ids).reorder(ancestry: :desc)
129
+ ).limit(1).pluck(attribute)
113
130
  end
131
+ value
132
+ end
133
+
134
+ def safe_content_facet
135
+ content_facet || build_content_facet
114
136
  end
115
137
  end
116
138
  end
@@ -49,8 +49,9 @@ module Katello
49
49
  has_many :content_facets, :class_name => "::Katello::Host::ContentFacet", :foreign_key => :content_source_id,
50
50
  :inverse_of => :content_source, :dependent => :nullify
51
51
 
52
- has_many :hostgroups, :class_name => "::Hostgroup", :foreign_key => :content_source_id,
52
+ has_many :hostgroup_content_facets, :class_name => "::Katello::Hostgroup::ContentFacet", :foreign_key => :content_source_id,
53
53
  :inverse_of => :content_source, :dependent => :nullify
54
+ has_many :hostgroups, :class_name => "::Hostgroup", :through => :hostgroup_content_facets
54
55
 
55
56
  validates :download_policy, inclusion: {
56
57
  :in => DOWNLOAD_POLICIES,
@@ -120,7 +121,8 @@ module Katello
120
121
  uri = pulp3_uri!
121
122
  config.host = uri.host
122
123
  config.scheme = uri.scheme
123
- pulp3_ssl_configuration(config)
124
+ config.ssl_client_cert = ::Cert::Certs.ssl_client_cert
125
+ config.ssl_client_key = ::Cert::Certs.ssl_client_key
124
126
  config.debugging = true
125
127
  config.logger = ::Foreman::Logging.logger('katello/pulp_rest')
126
128
  config.username = self.setting(PULP3_FEATURE, 'username')
@@ -128,18 +130,6 @@ module Katello
128
130
  end
129
131
  end
130
132
 
131
- def pulp3_ssl_configuration(config)
132
- if Faraday.default_adapter == :excon
133
- config.ssl_client_cert = ::Cert::Certs.ssl_client_cert_filename
134
- config.ssl_client_key = ::Cert::Certs.ssl_client_key_filename
135
- elsif Faraday.default_adapter == :net_http
136
- config.ssl_client_cert = ::Cert::Certs.ssl_client_cert
137
- config.ssl_client_key = ::Cert::Certs.ssl_client_key
138
- else
139
- fail "Unexpected faraday default_adapter #{Faraday.default_adapter}! Cannot continue, this is likely a bug."
140
- end
141
- end
142
-
143
133
  def backend_service_type(repository)
144
134
  if pulp3_support?(repository)
145
135
  Actions::Pulp3::Abstract::BACKEND_SERVICE_TYPE
@@ -153,7 +143,7 @@ module Katello
153
143
  end
154
144
 
155
145
  def pulp3_support?(repository)
156
- repository ? pulp3_repository_type_support?(repository.try(:content_type)) : false
146
+ pulp3_repository_type_support?(repository.content_type)
157
147
  end
158
148
 
159
149
  def pulp2_preferred_for_type?(repository_type)
@@ -343,7 +333,3 @@ module Katello
343
333
  end
344
334
  end
345
335
  end
346
-
347
- class ::SmartProxy::Jail < Safemode::Jail
348
- allow :hostname
349
- end
@@ -0,0 +1,23 @@
1
+ module Katello
2
+ module Concerns
3
+ module WidgetExtensions
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ SUBSCRIPTION_TEMPLATES = %w[subscription_status_widget subscription_widget].freeze
8
+
9
+ def without_subscription_widgets
10
+ where.not(template: ::Widget.singleton_class::SUBSCRIPTION_TEMPLATES)
11
+ end
12
+
13
+ def available
14
+ if Organization.current&.simple_content_access?
15
+ super.without_subscription_widgets
16
+ else
17
+ super
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -46,8 +46,10 @@ module Katello
46
46
  :inverse_of => :content_view, :dependent => :restrict_with_exception
47
47
  has_many :hosts, :class_name => "::Host::Managed", :through => :content_facets,
48
48
  :inverse_of => :content_view
49
- has_many :hostgroups, :class_name => "::Hostgroup", :foreign_key => :content_view_id,
49
+ has_many :hostgroup_content_facets, :class_name => "Katello::Hostgroup::ContentFacet", :foreign_key => :content_view_id,
50
50
  :inverse_of => :content_view, :dependent => :nullify
51
+ has_many :hostgroups, :class_name => "::Hostgroup", :through => :hostgroup_content_facets,
52
+ :inverse_of => :content_view
51
53
 
52
54
  has_many :repository_references, :class_name => 'Katello::Pulp3::RepositoryReference', :foreign_key => :content_view_id,
53
55
  :dependent => :destroy, :inverse_of => :content_view
@@ -719,6 +721,12 @@ module Katello
719
721
  self.organization
720
722
  end
721
723
 
724
+ apipie :class, desc: "A class representing #{model_name.human} object" do
725
+ name 'Content View'
726
+ refs 'ContentView'
727
+ sections only: %w[all additional]
728
+ prop_group :katello_basic_props, Katello::Model, meta: { friendly_name: 'Content View' }
729
+ end
722
730
  class Jail < ::Safemode::Jail
723
731
  allow :name, :label
724
732
  end
@@ -37,7 +37,7 @@ module Katello
37
37
  self.package_rules.each do |rule|
38
38
  package_filenames.concat(query_rpms(repo, rule))
39
39
  end
40
- package_filenames.concat(repo.packages_without_errata.map(&:filename)) if self.original_packages
40
+
41
41
  rpms = Rpm.in_repositories(repo)
42
42
  rpms.where(filename: package_filenames).where(:modular => false).pluck(:pulp_id).flatten.uniq
43
43
  end
@@ -383,6 +383,13 @@ module Katello
383
383
  [self.content_view]
384
384
  end
385
385
 
386
+ apipie :class, desc: "A class representing #{model_name.human} object" do
387
+ name 'Content View Version'
388
+ refs 'ContentViewVersion'
389
+ sections only: %w[all additional]
390
+ prop_group :katello_basic_props, Katello::Model, meta: { friendly_name: 'Content View Version' }
391
+ property :version, String, desc: 'Returns version of this content view'
392
+ end
386
393
  class Jail < ::Safemode::Jail
387
394
  allow :name, :label, :version
388
395
  end
@@ -161,6 +161,19 @@ module Katello
161
161
  { :conditions => conditions }
162
162
  end
163
163
 
164
+ apipie :class, desc: "A class representing #{model_name.human} object" do
165
+ name 'Erratum'
166
+ refs 'Erratum'
167
+ sections only: %w[all additional]
168
+ property :errata_id, String, desc: 'Returns errata identifier, e.g. "RHSA-1999-1231"'
169
+ property :errata_type, String, desc: 'Returns errata type, e.g. "security"'
170
+ property :issued, Date, desc: 'Returns the date of issue for the errata'
171
+ property :created_at, ActiveSupport::TimeWithZone, desc: 'Returns the time when the errata was created'
172
+ property :severity, String, desc: 'Returns severity of the errata, e.g. "Critical"'
173
+ property :package_names, array_of: String, desc: 'Returns names of packages the errata can be applied to'
174
+ property :cves, array_of: 'ErratumCve', desc: 'Returns CVEs associated with the errata'
175
+ property :reboot_suggested, one_of: [true, false], desc: 'Returns true if reboot is suggested after errata applying, false otherwise'
176
+ end
164
177
  class Jail < ::Safemode::Jail
165
178
  allow :errata_id, :errata_type, :issued, :created_at, :severity, :package_names, :cves, :reboot_suggested
166
179
  end
@@ -2,6 +2,14 @@ module Katello
2
2
  class ErratumCve < Katello::Model
3
3
  belongs_to :erratum, :inverse_of => :cves, :class_name => 'Katello::Erratum'
4
4
 
5
+ apipie :class, desc: 'A class representing Erratum CVE object' do
6
+ name 'Erratum CVE'
7
+ refs 'ErratumCve'
8
+ sections only: %w[all additional]
9
+ property :erratum, 'Erratum', desc: 'Returns Erratum object associated with this CVE'
10
+ property :cve_id, String, desc: 'Returns CVE identifier, e.g. "CVE-2223-0322"'
11
+ property :href, String, desc: 'Returns link to the CVE, e.g. https://www.redhat.com/security/data/cve/CVE-2233-0322.html'
12
+ end
5
13
  class Jail < ::Safemode::Jail
6
14
  allow :erratum, :cve_id, :href
7
15
  end
@@ -367,7 +367,7 @@ module Katello
367
367
  pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : SETTINGS[:katello][:pulp][:url])
368
368
  scheme = (self.unprotected && !force_https) ? 'http' : 'https'
369
369
  if docker?
370
- "#{pulp_uri.host.downcase}/#{container_repository_name}"
370
+ "#{pulp_uri.host.downcase}:#{Setting['pulp_docker_registry_port']}/#{container_repository_name}"
371
371
  elsif file?
372
372
  "#{scheme}://#{pulp_uri.host.downcase}/pulp/isos/#{relative_path}/"
373
373
  elsif puppet?
@@ -126,7 +126,6 @@ module Katello
126
126
  ::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::Erratum, bound_repos).calculate_and_import
127
127
  ::Katello::Applicability::ApplicableContentHelper.new(self, ::Katello::ModuleStream, bound_repos).calculate_and_import
128
128
  update_applicability_counts
129
- self.update_errata_status
130
129
  end
131
130
 
132
131
  def import_applicability(partial = false)
@@ -253,6 +252,24 @@ module Katello
253
252
  facet_attributes
254
253
  end
255
254
 
255
+ apipie :class, desc: "A class representing #{model_name.human} object" do
256
+ name 'Content Facet'
257
+ refs 'ContentFacet'
258
+ sections only: %w[all additional]
259
+ property :id, Integer, desc: 'Returns ID of the facet'
260
+ property :uuid, String, desc: 'Returns UUID of the facet'
261
+ property :applicable_module_stream_count, Integer, desc: 'Returns applicable Module Stream count'
262
+ property :upgradable_module_stream_count, Integer, desc: 'Returns upgradable Module Stream count'
263
+ property :applicable_rpm_count, Integer, desc: 'Returns applicable RPM count'
264
+ property :upgradable_rpm_count, Integer, desc: 'Returns upgradable RPM count'
265
+ property :content_source, 'SmartProxy', desc: 'Returns Smart Proxy object as the content source'
266
+ prop_group :katello_idname_props, Katello::Model, meta: { resource: 'content_source' }
267
+ prop_group :katello_idname_props, Katello::Model, meta: { resource: 'content_view' }
268
+ property :errata_counts, Hash, desc: 'Returns key=value object with errata counts, e.g. {security: 0, bugfix: 0, enhancement: 0, total: 0}'
269
+ property :kickstart_repository, 'Repository', desc: 'Returns Kickstart repository object'
270
+ prop_group :katello_idname_props, Katello::Model, meta: { resource: 'kickstart_repository' }
271
+ prop_group :katello_idname_props, Katello::Model, meta: { resource: 'lifecycle_environment' }
272
+ end
256
273
  class Jail < ::Safemode::Jail
257
274
  allow :applicable_module_stream_count, :applicable_rpm_count, :content_source, :content_source_id, :content_source_name, :content_view_id,
258
275
  :content_view_name, :errata_counts, :id, :kickstart_repository, :kickstart_repository_id, :kickstart_repository_name,
@@ -102,6 +102,12 @@ module Katello
102
102
  _("Host Collections")
103
103
  end
104
104
 
105
+ apipie :class, desc: "A class representing #{model_name.human} object" do
106
+ name 'Host Collection'
107
+ refs 'HostCollection'
108
+ sections only: %w[all additional]
109
+ property :name, String, desc: 'Returns name of the host collection'
110
+ end
105
111
  class Jail < ::Safemode::Jail
106
112
  allow :name
107
113
  end
@@ -0,0 +1,18 @@
1
+ module Katello
2
+ module Hostgroup
3
+ class ContentFacet < Katello::Model
4
+ audited :associated_with => :lifecycle_environment
5
+ self.table_name = 'katello_hostgroup_content_facets'
6
+ include Facets::HostgroupFacet
7
+
8
+ belongs_to :kickstart_repository, :class_name => "::Katello::Repository", :foreign_key => :kickstart_repository_id, :inverse_of => :kickstart_hostgroup_content_facets
9
+ belongs_to :content_view, :inverse_of => :hostgroup_content_facets, :class_name => "Katello::ContentView"
10
+ belongs_to :lifecycle_environment, :inverse_of => :hostgroup_content_facets, :class_name => "Katello::KTEnvironment"
11
+ belongs_to :content_source, :class_name => "::SmartProxy", :foreign_key => :content_source_id, :inverse_of => :hostgroup_content_facets
12
+
13
+ validates_with Katello::Validators::ContentViewEnvironmentValidator
14
+ validates_with Katello::Validators::HostgroupKickstartRepositoryValidator
15
+ validates_with ::AssociationExistsValidator, attributes: [:content_source]
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,13 @@
1
1
  module Katello
2
2
  class InstalledPackage < Katello::Model
3
+ apipie :class, desc: "A class representing #{model_name.human} object" do
4
+ name 'Installed Package'
5
+ refs 'InstalledPackage'
6
+ sections only: %w[all additional]
7
+ property :name, String, desc: 'Returns name of the package'
8
+ property :nvra, String, desc: 'Returns package name with version, release and architecture'
9
+ property :nvrea, String, desc: 'Returns package name with version, release, epoch and architecture'
10
+ end
3
11
  class Jail < Safemode::Jail
4
12
  allow :nvra, :nvrea, :name
5
13
  end
@@ -31,8 +31,10 @@ module Katello
31
31
  :inverse_of => :lifecycle_environment, :dependent => :restrict_with_exception
32
32
  has_many :hosts, :class_name => "::Host::Managed", :through => :content_facets,
33
33
  :inverse_of => :lifecycle_environment
34
- has_many :hostgroups, :class_name => "::Hostgroup", :foreign_key => :lifecycle_environment_id,
34
+ has_many :hostgroup_content_facets, :class_name => "Katello::Hostgroup::ContentFacet", :foreign_key => :lifecycle_environment_id,
35
35
  :inverse_of => :lifecycle_environment, :dependent => :restrict_with_exception
36
+ has_many :hostgroups, :class_name => "::Hostgroup", :through => :hostgroup_content_facets,
37
+ :inverse_of => :lifecycle_environment
36
38
 
37
39
  scope :completer_scope, ->(options = nil) { where('organization_id = ?', options[:organization_id]) if options[:organization_id].present? }
38
40
  scope :non_library, -> { where(library: false) }
@@ -259,6 +261,12 @@ module Katello
259
261
  'lifecycle_environments'
260
262
  end
261
263
 
264
+ apipie :class, desc: "A class representing #{model_name.human} object" do
265
+ name 'Katello Environment'
266
+ refs 'KTEnvironment'
267
+ sections only: %w[all additional]
268
+ prop_group :katello_basic_props, Katello::Model, meta: { friendly_name: 'Katello Environment' }
269
+ end
262
270
  class Jail < ::Safemode::Jail
263
271
  allow :name, :label
264
272
  end
@@ -3,6 +3,22 @@ module Katello
3
3
  include ActiveModel::ForbiddenAttributesProtection
4
4
  self.abstract_class = true
5
5
 
6
+ apipie :prop_group, name: :katello_basic_props do
7
+ meta_example = ", e.g. #{@meta[:example]}" if @meta[:example]
8
+ name_desc = @meta[:name_desc] || "Name of the #{@meta[:friendly_name] || @meta[:class_scope]}#{meta_example}"
9
+ property :name, String, desc: name_desc
10
+ property :label, String, desc: "Label of the #{@meta[:friendly_name] || @meta[:class_scope]}"
11
+ end
12
+
13
+ apipie :prop_group, name: :katello_idname_props do
14
+ if @meta[:resource]
15
+ resource = @meta[:resource].humanize(capitalize: false)
16
+ prefix = "#{resource}_"
17
+ end
18
+ property "#{prefix}id".to_sym, Integer, desc: "Returns ID of the #{@meta[:friendly_name] || resource}"
19
+ property "#{prefix}name".to_sym, String, desc: "Returns name of the #{@meta[:friendly_name] || resource}"
20
+ end
21
+
6
22
  def destroy!
7
23
  unless destroy
8
24
  fail self.errors.full_messages.join('; ')