katello 3.1.0.1 → 3.2.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 (390) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -47
  3. data/app/assets/javascripts/katello/common/index.js +0 -1
  4. data/app/assets/javascripts/katello/providers/redhat/index.js +0 -1
  5. data/app/assets/stylesheets/katello/_katello_colors.scss +0 -2
  6. data/app/assets/stylesheets/katello/katello.scss +0 -2
  7. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +45 -42
  8. data/app/controllers/katello/api/v2/activation_keys_controller.rb +7 -19
  9. data/app/controllers/katello/api/v2/api_controller.rb +3 -3
  10. data/app/controllers/katello/api/v2/capsule_content_controller.rb +3 -3
  11. data/app/controllers/katello/api/v2/content_uploads_controller.rb +2 -2
  12. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +29 -18
  13. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +2 -2
  14. data/app/controllers/katello/api/v2/content_view_histories_controller.rb +1 -1
  15. data/app/controllers/katello/api/v2/content_view_puppet_modules_controller.rb +2 -2
  16. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +10 -8
  17. data/app/controllers/katello/api/v2/content_views_controller.rb +5 -5
  18. data/app/controllers/katello/api/v2/environments_controller.rb +10 -9
  19. data/app/controllers/katello/api/v2/file_units_controller.rb +16 -0
  20. data/app/controllers/katello/api/v2/gpg_keys_controller.rb +4 -4
  21. data/app/controllers/katello/api/v2/host_autocomplete_controller.rb +2 -2
  22. data/app/controllers/katello/api/v2/host_collections_controller.rb +41 -13
  23. data/app/controllers/katello/api/v2/host_errata_controller.rb +12 -5
  24. data/app/controllers/katello/api/v2/host_packages_controller.rb +4 -4
  25. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +9 -9
  26. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +52 -13
  27. data/app/controllers/katello/api/v2/organizations_controller.rb +3 -3
  28. data/app/controllers/katello/api/v2/packages_controller.rb +1 -1
  29. data/app/controllers/katello/api/v2/ping_controller.rb +2 -2
  30. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +2 -2
  31. data/app/controllers/katello/api/v2/products_controller.rb +6 -16
  32. data/app/controllers/katello/api/v2/repositories_bulk_actions_controller.rb +1 -1
  33. data/app/controllers/katello/api/v2/repositories_controller.rb +60 -21
  34. data/app/controllers/katello/api/v2/repository_sets_controller.rb +3 -3
  35. data/app/controllers/katello/api/v2/root_controller.rb +2 -2
  36. data/app/controllers/katello/api/v2/subscriptions_controller.rb +19 -10
  37. data/app/controllers/katello/api/v2/sync_controller.rb +3 -3
  38. data/app/controllers/katello/api/v2/sync_plans_controller.rb +2 -2
  39. data/app/controllers/katello/api/v2/uebercerts_controller.rb +1 -1
  40. data/app/controllers/katello/application_controller.rb +7 -7
  41. data/app/controllers/katello/auto_complete_search_controller.rb +1 -1
  42. data/app/controllers/katello/concerns/api/api_controller.rb +1 -1
  43. data/app/controllers/katello/concerns/api/v2/hostgroups_controller_extensions.rb +19 -16
  44. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +8 -6
  45. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +10 -6
  46. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +1 -1
  47. data/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb +1 -1
  48. data/app/controllers/katello/errors_controller.rb +2 -2
  49. data/app/controllers/katello/organizations_controller.rb +1 -1
  50. data/app/controllers/katello/products_controller.rb +4 -4
  51. data/app/controllers/katello/providers_controller.rb +2 -2
  52. data/app/helpers/katello/application_helper.rb +0 -240
  53. data/app/helpers/katello/concerns/hosts_and_hostgroups_helper_extensions.rb +19 -0
  54. data/app/lib/actions/candlepin/import_pool_handler.rb +11 -6
  55. data/app/lib/actions/katello/capsule_content/create_repos.rb +3 -3
  56. data/app/lib/actions/katello/capsule_content/sync.rb +23 -9
  57. data/app/lib/actions/katello/content_view/add_to_environment.rb +1 -1
  58. data/app/lib/actions/katello/content_view/errata_mail.rb +2 -2
  59. data/app/lib/actions/katello/content_view/incremental_updates.rb +60 -1
  60. data/app/lib/actions/katello/content_view/remove.rb +2 -2
  61. data/app/lib/actions/katello/content_view_environment/destroy.rb +1 -1
  62. data/app/lib/actions/katello/content_view_environment/reassign_objects.rb +2 -2
  63. data/app/lib/actions/katello/content_view_puppet_environment/create.rb +3 -1
  64. data/app/lib/actions/katello/host/attach_subscriptions.rb +13 -6
  65. data/app/lib/actions/katello/host/destroy.rb +0 -19
  66. data/app/lib/actions/katello/host/generate_applicability.rb +8 -3
  67. data/app/lib/actions/katello/host/hypervisors.rb +17 -9
  68. data/app/lib/actions/katello/host/hypervisors_update.rb +19 -44
  69. data/app/lib/actions/katello/host/reassign.rb +14 -0
  70. data/app/lib/actions/katello/host/register.rb +3 -22
  71. data/app/lib/actions/katello/host/remove_subscriptions.rb +15 -2
  72. data/app/lib/actions/katello/host/update.rb +0 -6
  73. data/app/lib/actions/katello/organization/destroy.rb +2 -2
  74. data/app/lib/actions/katello/product/content_destroy.rb +7 -9
  75. data/app/lib/actions/katello/product/destroy.rb +23 -7
  76. data/app/lib/actions/katello/repository/clear.rb +1 -0
  77. data/app/lib/actions/katello/repository/clone_file_content.rb +17 -0
  78. data/app/lib/actions/katello/repository/clone_to_environment.rb +2 -0
  79. data/app/lib/actions/katello/repository/clone_to_version.rb +2 -0
  80. data/app/lib/actions/katello/repository/create.rb +2 -1
  81. data/app/lib/actions/katello/repository/destroy.rb +20 -10
  82. data/app/lib/actions/katello/repository/errata_mail.rb +2 -2
  83. data/app/lib/actions/katello/repository/filtered_index_content.rb +2 -0
  84. data/app/lib/actions/katello/repository/import_upload.rb +6 -2
  85. data/app/lib/actions/katello/repository/{refresh_repostiory.rb → refresh_repository.rb} +0 -0
  86. data/app/lib/actions/katello/repository/remove_content.rb +2 -0
  87. data/app/lib/actions/katello/repository/sync.rb +8 -12
  88. data/app/lib/actions/katello/repository_set/disable_repository.rb +6 -5
  89. data/app/lib/actions/katello/repository_set/enable_repository.rb +1 -1
  90. data/app/lib/actions/katello/repository_set/scan_cdn.rb +1 -1
  91. data/app/lib/actions/pulp/abstract_async_task.rb +1 -1
  92. data/app/lib/actions/pulp/consumer/unassociate_units.rb +20 -0
  93. data/app/lib/actions/pulp/repository/copy_files.rb +11 -0
  94. data/app/lib/actions/pulp/repository/create.rb +5 -1
  95. data/app/lib/actions/pulp/repository/presenters/file_presenter.rb +1 -1
  96. data/app/lib/actions/pulp/repository/refresh.rb +4 -2
  97. data/app/lib/actions/pulp/repository/remove_file.rb +15 -0
  98. data/app/lib/actions/pulp/repository/sync.rb +3 -1
  99. data/app/lib/actions/pulp/repository_group/export.rb +1 -1
  100. data/app/lib/katello/errors.rb +1 -1
  101. data/app/lib/katello/lazy_accessor.rb +1 -1
  102. data/app/lib/katello/resources/candlepin.rb +14 -0
  103. data/app/lib/katello/util/cdn_var_substitutor.rb +5 -2
  104. data/app/lib/katello/util/model.rb +1 -2
  105. data/app/lib/katello/util/package.rb +2 -2
  106. data/app/models/katello/activation_key.rb +0 -49
  107. data/app/models/katello/authorization/content_view_version.rb +7 -0
  108. data/app/models/katello/candlepin/content.rb +15 -3
  109. data/app/models/katello/concerns/container_extensions.rb +1 -2
  110. data/app/models/katello/concerns/content_facet_host_extensions.rb +11 -1
  111. data/app/models/katello/concerns/host_managed_extensions.rb +4 -13
  112. data/app/models/katello/concerns/hostgroup_extensions.rb +0 -2
  113. data/app/models/katello/concerns/medium_extensions.rb +2 -2
  114. data/app/models/katello/concerns/organization_extensions.rb +0 -5
  115. data/app/models/katello/concerns/pulp_database_unit.rb +5 -1
  116. data/app/models/katello/concerns/smart_proxy_extensions.rb +21 -1
  117. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +1 -2
  118. data/app/models/katello/content_view.rb +12 -6
  119. data/app/models/katello/content_view_component.rb +0 -3
  120. data/app/models/katello/content_view_environment.rb +2 -2
  121. data/app/models/katello/content_view_package_filter_rule.rb +13 -0
  122. data/app/models/katello/content_view_puppet_environment.rb +2 -2
  123. data/app/models/katello/content_view_repository.rb +2 -1
  124. data/app/models/katello/content_view_version.rb +9 -2
  125. data/app/models/katello/erratum.rb +1 -5
  126. data/app/models/katello/file_unit.rb +41 -0
  127. data/app/models/katello/glue/candlepin/activation_key.rb +2 -2
  128. data/app/models/katello/glue/candlepin/pool.rb +19 -14
  129. data/app/models/katello/glue/pulp/repo.rb +44 -10
  130. data/app/models/katello/host/content_facet.rb +6 -6
  131. data/app/models/katello/host/subscription_facet.rb +6 -8
  132. data/app/models/katello/kt_environment.rb +3 -5
  133. data/app/models/katello/package_group.rb +1 -3
  134. data/app/models/katello/pool.rb +7 -2
  135. data/app/models/katello/pool_with_quantities.rb +12 -0
  136. data/app/models/katello/product.rb +6 -0
  137. data/app/models/katello/provider.rb +1 -1
  138. data/app/models/katello/puppet_module.rb +1 -2
  139. data/app/models/katello/repository.rb +7 -3
  140. data/app/models/katello/repository_file.rb +9 -0
  141. data/app/models/katello/rpm.rb +1 -1
  142. data/app/models/katello/subscription_status.rb +1 -1
  143. data/app/models/katello/sync_plan.rb +2 -1
  144. data/app/models/katello/task_status.rb +3 -36
  145. data/app/models/setting/content.rb +4 -1
  146. data/app/overrides/add_activation_keys_input.rb +2 -2
  147. data/app/presenters/katello/activation_key_subscriptions_presenter.rb +10 -0
  148. data/app/services/katello/candlepin/consumer.rb +5 -1
  149. data/app/services/katello/pulp/file_unit.rb +13 -0
  150. data/app/views/dashboard/_errata_widget.html.erb +1 -1
  151. data/app/views/dashboard/_subscription_widget.html.erb +30 -8
  152. data/app/views/foreman/job_templates/install_errata.erb +1 -1
  153. data/app/views/katello/api/v2/activation_keys/product_content.json.rabl +1 -0
  154. data/app/views/katello/api/v2/capsule_content/sync_status.json.rabl +2 -2
  155. data/app/views/katello/api/v2/content_facet/base.json.rabl +2 -4
  156. data/app/views/katello/api/v2/{systems → content_facet}/erratum.json.rabl +0 -0
  157. data/app/views/katello/api/v2/content_facet/show.json.rabl +1 -1
  158. data/app/views/katello/api/v2/content_view_versions/base.json.rabl +5 -4
  159. data/app/views/katello/api/v2/environments/show.json.rabl +1 -1
  160. data/app/views/katello/api/v2/file_units/base.json.rabl +7 -0
  161. data/app/views/katello/api/v2/{systems → file_units}/index.json.rabl +1 -1
  162. data/app/views/katello/api/v2/file_units/show.json.rabl +3 -0
  163. data/app/views/katello/api/v2/host_errata/index.json.rabl +1 -1
  164. data/app/views/katello/api/v2/host_errata/show.json.rabl +1 -1
  165. data/app/views/katello/api/v2/package_groups/base.json.rabl +1 -1
  166. data/app/views/katello/api/v2/ping/show.json.rabl +1 -1
  167. data/app/views/katello/api/v2/repositories/base.json.rabl +2 -1
  168. data/app/views/katello/api/v2/repositories/show.json.rabl +1 -1
  169. data/app/views/katello/api/v2/subscription_facet/base.json.rabl +1 -1
  170. data/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl +0 -4
  171. data/app/views/katello/api/v2/subscription_facet/show.json.rabl +1 -5
  172. data/app/views/katello/api/v2/subscriptions/base.json.rabl +3 -3
  173. data/app/views/katello/api/v2/subscriptions/index.json.rabl +1 -0
  174. data/app/views/katello/api/v2/tasks/task_status_show.json.rabl +0 -1
  175. data/app/views/katello/providers/redhat/show.html.erb +1 -1
  176. data/app/views/katello/sync_management/_products.html.erb +5 -1
  177. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +1 -9
  178. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +1 -0
  179. data/config/routes/api/v2.rb +9 -2
  180. data/config/routes/overrides.rb +9 -0
  181. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  182. data/db/migrate/20160617124149_remove_duplicate_view_filters.rb +38 -0
  183. data/db/migrate/20160627125310_delete_system.rb +7 -0
  184. data/db/migrate/20160722193256_add_verify_ssl_on_sync_to_repository.rb +9 -0
  185. data/db/migrate/20160727144242_add_registered_through_to_katello_subscription_facets.rb +5 -0
  186. data/db/migrate/20160808002834_add_files.rb +30 -0
  187. data/db/migrate/20160906181923_add_puppet_path_to_smart_proxy.rb +5 -0
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.module.js +1 -0
  189. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +7 -6
  190. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-add-subscriptions.html +6 -2
  191. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +4 -0
  192. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +101 -102
  193. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-subscriptions-list.html +3 -0
  194. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/views/activation-key-new.html +82 -83
  195. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/views/activation-keys.html +4 -0
  196. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
  197. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.module.js +3 -1
  198. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsules/capsules.module.js +4 -1
  199. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/common.module.js +2 -0
  200. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/common/views/registration.html +1 -0
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-action-subscriptions.controller.js +46 -72
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-action.controller.js +1 -2
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-errata.html +5 -0
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-host-collections.html +5 -0
  205. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-subscriptions.html +79 -33
  206. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.module.js +1 -0
  207. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +10 -0
  208. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +27 -15
  209. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +57 -45
  210. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-add-subscriptions.controller.js +5 -18
  211. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-base-subscriptions.controller.js +2 -3
  212. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +2 -1
  213. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-subscriptions.controller.js +3 -3
  214. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-add-subscriptions.html +4 -0
  215. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +117 -118
  216. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +13 -8
  217. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions-list.html +5 -0
  218. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +5 -0
  219. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.module.js +1 -0
  220. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +26 -0
  221. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +11 -4
  222. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-environments.controller.js +1 -1
  223. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion.controller.js +1 -1
  224. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/content-view-deletion.html +3 -3
  225. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-content-hosts.html +2 -2
  226. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-environments.html +2 -2
  227. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-file-repositories.controller.js +47 -0
  228. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +8 -0
  229. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-file-repositories-list.controller.js +45 -0
  230. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter-details.html +4 -0
  231. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filters.html +3 -0
  232. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +6 -6
  233. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-module-names.html +6 -0
  234. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-modules.html +4 -0
  235. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-composite-available-content-views.html +2 -1
  236. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-composite-content-views-list.html +2 -1
  237. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +151 -140
  238. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-docker-repositories.html +1 -1
  239. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-file-repositories.html +118 -0
  240. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-ostree-repositories.html +1 -1
  241. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-repositories.html +1 -1
  242. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +13 -2
  243. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +8 -0
  244. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-versions.module.js +1 -0
  245. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-details.html +8 -6
  246. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-file.html +22 -0
  247. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +6 -16
  248. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +4 -0
  249. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-manifests/docker-manifests.module.js +6 -1
  250. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tags-details.html +59 -61
  251. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/docker-tags.module.js +3 -0
  252. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/views/docker-tags.html +4 -0
  253. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-content-views.html +5 -0
  254. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-docker.html +4 -0
  255. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-errata.html +4 -0
  256. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-ostree.html +4 -0
  257. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-packages.html +4 -0
  258. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-puppet-modules.html +4 -0
  259. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-repositories.html +4 -0
  260. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/environments.module.js +1 -0
  261. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/errata-content-hosts.controller.js +1 -1
  262. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details-content-hosts.html +6 -2
  263. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details-repositories.html +4 -0
  264. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/views/errata-details.html +44 -45
  265. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.module.js +2 -0
  266. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata.html +5 -0
  267. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/gpg-key-details-info.controller.js +11 -0
  268. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/gpg-key-details.controller.js +1 -1
  269. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-details.html +52 -48
  270. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-info.html +1 -0
  271. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-products.html +1 -1
  272. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-repositories.html +1 -1
  273. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/gpg-keys.module.js +1 -0
  274. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/new/views/gpg-key-new.html +62 -63
  275. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/views/gpg-keys.html +6 -3
  276. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-add-hosts.html +4 -0
  277. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-details.html +85 -86
  278. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-hosts-list.html +4 -0
  279. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/host-collections.module.js +1 -0
  280. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/new/views/host-collection-new.html +16 -17
  281. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/views/host-collections.html +5 -0
  282. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +28 -0
  283. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-erratum.factory.js +1 -0
  284. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host.factory.js +1 -27
  285. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/hosts.module.js +3 -1
  286. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organization.factory.js +0 -1
  287. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/organizations.module.js +4 -1
  288. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branches-details-repositories.controller.js +60 -0
  289. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/ostree-branches-details.controller.js +31 -0
  290. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branches-details-info.html +23 -0
  291. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branches-details-repositories.html +83 -0
  292. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/details/views/ostree-branches-details.html +43 -0
  293. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.controller.js +67 -0
  294. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.module.js +5 -1
  295. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/ostree-branches.routes.js +53 -0
  296. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches-table-collapsed.html +19 -0
  297. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches-table-full.html +21 -0
  298. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/ostree-branches/views/ostree-branches.html +19 -0
  299. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/package-groups/package-groups.module.js +7 -1
  300. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/package-details.controller.js +17 -2
  301. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/packages-details-info.html +10 -0
  302. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/packages-details-repositories.html +4 -0
  303. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/views/packages-details.html +51 -52
  304. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/packages.module.js +3 -0
  305. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/views/packages.html +5 -0
  306. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +72 -73
  307. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-repositories.html +19 -7
  308. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/views/discovery-create.html +144 -145
  309. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/new/views/product-new.html +17 -18
  310. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.module.js +1 -0
  311. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/views/products.html +4 -0
  312. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/details/views/puppet-modules-details.html +44 -40
  313. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/puppet-modules.module.js +7 -1
  314. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/views/puppet-modules.html +4 -0
  315. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/repository-details-info.controller.js +11 -5
  316. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/details/views/repository-info.html +343 -324
  317. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/new/new-repository.controller.js +4 -4
  318. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/new/views/repository-new.html +10 -0
  319. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/repositories.module.js +1 -0
  320. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/settings/settings.module.js +2 -0
  321. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-associations-content-hosts.html +2 -2
  322. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-details.html +46 -47
  323. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js +10 -0
  324. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest-import.html +1 -0
  325. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest.html +41 -42
  326. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions-helper.service.js +15 -1
  327. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.module.js +1 -0
  328. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/subscriptions.html +4 -0
  329. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +54 -55
  330. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plans.module.js +1 -0
  331. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/views/sync-plans.html +4 -0
  332. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/tasks.module.js +3 -1
  333. data/engines/bastion_katello/lib/bastion_katello/engine.rb +1 -0
  334. data/lib/katello/engine.rb +11 -1
  335. data/lib/katello/permissions/host_permissions.rb +13 -1
  336. data/lib/katello/plugin.rb +20 -1
  337. data/lib/katello/tasks/reimport.rake +1 -0
  338. data/lib/katello/tasks/test.rake +8 -0
  339. data/lib/katello/tasks/unify_hosts.rake +91 -0
  340. data/lib/katello/tasks/upgrade_check.rake +3 -2
  341. data/lib/katello/tasks/upgrades/3.0/update_subscription_facet_backend_data.rake +2 -4
  342. data/lib/katello/version.rb +1 -1
  343. data/lib/proxy_api/pulp.rb +7 -0
  344. data/lib/proxy_api/pulp_node.rb +7 -0
  345. metadata +79 -67
  346. data/app/assets/javascripts/katello/common/jquery.jeditable.custominputs.js +0 -180
  347. data/app/assets/javascripts/katello/widgets/jquery.jeditable.helpers.js +0 -247
  348. data/app/assets/stylesheets/katello/widgets/_scrollpane.scss +0 -66
  349. data/app/controllers/katello/api/v2/systems_controller.rb +0 -213
  350. data/app/helpers/katello/activation_keys_helper.rb +0 -4
  351. data/app/helpers/katello/host_collection_events_helper.rb +0 -7
  352. data/app/helpers/katello/katello_form_builder.rb +0 -150
  353. data/app/helpers/katello/packages_helper.rb +0 -67
  354. data/app/helpers/katello/subscriptions_helper.rb +0 -32
  355. data/app/helpers/katello/system_events_helper.rb +0 -4
  356. data/app/helpers/katello/system_packages_helper.rb +0 -42
  357. data/app/lib/actions/katello/repository/incremental_import.rb +0 -61
  358. data/app/lib/actions/katello/subscription/subscribe.rb +0 -26
  359. data/app/lib/actions/katello/system/destroy.rb +0 -17
  360. data/app/lib/actions/katello/system/reassign.rb +0 -14
  361. data/app/models/katello/authorization/system.rb +0 -53
  362. data/app/models/katello/glue/candlepin/consumer.rb +0 -386
  363. data/app/models/katello/glue/pulp/consumer.rb +0 -171
  364. data/app/models/katello/hypervisor.rb +0 -15
  365. data/app/models/katello/system.rb +0 -283
  366. data/app/models/katello/system_activation_key.rb +0 -8
  367. data/app/models/katello/system_repository.rb +0 -8
  368. data/app/presenters/katello/activation_key_subscription_presenter.rb +0 -10
  369. data/app/views/katello/api/v2/errata/_applicable_errata.json.rabl +0 -3
  370. data/app/views/katello/api/v2/subscriptions/create.json.rabl +0 -3
  371. data/app/views/katello/api/v2/systems/_pool.json.rabl +0 -6
  372. data/app/views/katello/api/v2/systems/activate.json.rabl +0 -3
  373. data/app/views/katello/api/v2/systems/add_host_collections.json.rabl +0 -3
  374. data/app/views/katello/api/v2/systems/available_host_collections.json.rabl +0 -5
  375. data/app/views/katello/api/v2/systems/base.json.rabl +0 -35
  376. data/app/views/katello/api/v2/systems/enabled_repos.json.rabl +0 -3
  377. data/app/views/katello/api/v2/systems/events.json.rabl +0 -3
  378. data/app/views/katello/api/v2/systems/package.json.rabl +0 -5
  379. data/app/views/katello/api/v2/systems/package_profile.json.rabl +0 -7
  380. data/app/views/katello/api/v2/systems/pools.json.rabl +0 -7
  381. data/app/views/katello/api/v2/systems/regenerate_identity_certificates.json.rabl +0 -3
  382. data/app/views/katello/api/v2/systems/remove_host_collections.json.rabl +0 -3
  383. data/app/views/katello/api/v2/systems/show.json.rabl +0 -64
  384. data/app/views/katello/api/v2/systems/subscriptions.json.rabl +0 -8
  385. data/app/views/katello/api/v2/systems/upload_package_profile.json.rabl +0 -3
  386. data/db/seeds.d/105-roles_permissions.rb +0 -71
  387. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host.factory.js +0 -25
  388. data/lib/katello/permissions/content_host_permissions.rb +0 -30
  389. data/lib/katello/tasks/yard.rake +0 -9
  390. data/vendor/assets/stylesheets/katello/jquery.jscrollpane.css +0 -120
@@ -12,8 +12,6 @@ module Katello
12
12
 
13
13
  validates_with Katello::Validators::ContentViewEnvironmentValidator
14
14
 
15
- attr_accessible :content_view_id, :lifecycle_environment_id, :content_source_id, :kickstart_repository_id
16
-
17
15
  scoped_search :in => :content_source, :on => :name, :complete_value => true, :rename => :content_source
18
16
  scoped_search :in => :content_view, :on => :name, :complete_value => true, :rename => :content_view
19
17
  scoped_search :in => :lifecycle_environment, :on => :name, :complete_value => true, :rename => :lifecycle_environment
@@ -15,7 +15,7 @@ module Katello
15
15
 
16
16
  medium_path = ::Medium.installation_media_path(repo.uri)
17
17
 
18
- if distribution = repo.distribution_bootable?
18
+ if (distribution = repo.distribution_bootable?)
19
19
  return if ::Medium.find_by(:path => medium_path)
20
20
 
21
21
  os = ::Redhat.find_or_create_operating_system(repo)
@@ -30,7 +30,7 @@ module Katello
30
30
  os.save!
31
31
 
32
32
  else
33
- if medium = ::Medium.find_by(:path => medium_path)
33
+ if (medium = ::Medium.find_by(:path => medium_path))
34
34
  medium.destroy
35
35
  end
36
36
  end
@@ -32,7 +32,6 @@ module Katello
32
32
  has_many :org_tasks, :dependent => :destroy, :class_name => "Katello::TaskStatus", :inverse_of => :organization
33
33
 
34
34
  attr_accessor :statistics
35
- attr_accessible :label, :service_level
36
35
 
37
36
  scope :having_name_or_label, ->(name_or_label) { where("name = :id or label = :id", :id => name_or_label) }
38
37
  scoped_search :on => :label, :complete_value => :true
@@ -45,10 +44,6 @@ module Katello
45
44
  ContentView.default.where(:organization_id => self.id).first
46
45
  end
47
46
 
48
- def systems
49
- System.where(:environment_id => kt_environments)
50
- end
51
-
52
47
  def promotion_paths
53
48
  #I'm sure there's a better way to do this
54
49
  self.kt_environments.joins(:priors).where("prior_id = #{self.library.id}").order(:name).collect do |env|
@@ -46,10 +46,14 @@ module Katello
46
46
  all_items.count
47
47
  end
48
48
 
49
+ def unit_id_field
50
+ "#{self.name.demodulize.underscore}_id"
51
+ end
52
+
49
53
  def sync_repository_associations(repository, unit_uuids, additive = false)
50
54
  associated_ids = with_uuid(unit_uuids).pluck(:id)
51
55
  table_name = self.repository_association_class.table_name
52
- attribute_name = "#{self.name.demodulize.underscore}_id"
56
+ attribute_name = unit_id_field
53
57
 
54
58
  existing_ids = self.repository_association_class.uncached do
55
59
  self.repository_association_class.where(:repository_id => repository).pluck(attribute_name)
@@ -10,10 +10,11 @@ module Katello
10
10
  include ForemanTasks::Concerns::ActionSubject
11
11
  include LazyAccessor
12
12
 
13
+ alias_method_chain :refresh, :puppet_path
14
+
13
15
  before_create :associate_organizations
14
16
  before_create :associate_default_location
15
17
  before_create :associate_lifecycle_environments
16
- attr_accessible :lifecycle_environment_ids
17
18
 
18
19
  lazy_accessor :pulp_repositories, :initializer => lambda { |_s| pulp_node.extensions.repository.retrieve_all }
19
20
 
@@ -46,6 +47,25 @@ module Katello
46
47
  end
47
48
  end
48
49
 
50
+ def puppet_path
51
+ self[:puppet_path] || update_puppet_path
52
+ end
53
+
54
+ def update_puppet_path
55
+ if has_feature?(PULP_FEATURE)
56
+ path = ProxyAPI::Pulp.new(:url => self.url).capsule_puppet_path['puppet_content_dir']
57
+ elsif has_feature?(PULP_NODE_FEATURE)
58
+ path = ProxyAPI::PulpNode.new(:url => self.url).capsule_puppet_path['puppet_content_dir']
59
+ end
60
+ self.update_attribute(:puppet_path, path) if path
61
+ end
62
+
63
+ def refresh_with_puppet_path
64
+ errors = refresh_without_puppet_path
65
+ update_puppet_path
66
+ errors
67
+ end
68
+
49
69
  def pulp_node
50
70
  @pulp_node ||= Katello::Pulp::Server.config(pulp_url, User.remote_user)
51
71
  end
@@ -19,12 +19,11 @@ module Katello
19
19
  scoped_search :on => :status, :in => :subscription_status_object, :rename => :subscription_status,
20
20
  :complete_value => SUBSCRIPTION_STATUS_MAP
21
21
 
22
- attr_accessible :subscription_facet_attributes
23
-
24
22
  scoped_search :on => :release_version, :in => :subscription_facet, :complete_value => true
25
23
  scoped_search :on => :autoheal, :in => :subscription_facet, :complete_value => true
26
24
  scoped_search :on => :service_level, :in => :subscription_facet, :complete_value => true
27
25
  scoped_search :on => :last_checkin, :in => :subscription_facet, :complete_value => true
26
+ scoped_search :on => :registered_through, :in => :subscription_facet, :complete_value => true
28
27
  scoped_search :on => :registered_at, :in => :subscription_facet, :rename => :registered_at
29
28
  scoped_search :on => :uuid, :in => :subscription_facet, :rename => :subscription_uuid
30
29
  scoped_search :in => :activation_keys, :on => :name, :rename => :activation_key, :complete_value => true, :ext_method => :find_by_activation_key
@@ -36,7 +36,6 @@ module Katello
36
36
  has_many :filters, :dependent => :destroy, :class_name => "Katello::ContentViewFilter"
37
37
 
38
38
  has_many :activation_keys, :class_name => "Katello::ActivationKey", :dependent => :restrict_with_exception
39
- has_many :systems, :class_name => "Katello::System", :dependent => :restrict_with_exception
40
39
 
41
40
  has_many :content_facets, :class_name => "Katello::Host::ContentFacet", :foreign_key => :content_view_id,
42
41
  :inverse_of => :content_view, :dependent => :restrict_with_exception
@@ -50,6 +49,7 @@ module Katello
50
49
  :presence => true
51
50
  validates :name, :presence => true, :uniqueness => {:scope => :organization_id}
52
51
  validates :organization_id, :presence => true
52
+ validate :check_non_composite_components
53
53
  validate :check_repo_conflicts
54
54
  validate :check_puppet_conflicts
55
55
  validates :composite, :inclusion => [true, false]
@@ -76,7 +76,7 @@ module Katello
76
76
  end
77
77
 
78
78
  def content_host_count
79
- systems.count
79
+ hosts.count
80
80
  end
81
81
 
82
82
  def copy(new_name)
@@ -288,7 +288,7 @@ module Katello
288
288
  end
289
289
  version = ContentViewVersion.find(version.id)
290
290
 
291
- if foreman_env = Environment.find_by_katello_id(self.organization, from_env, self)
291
+ if (foreman_env = Environment.find_by_katello_id(self.organization, from_env, self))
292
292
  foreman_env.destroy
293
293
  end
294
294
 
@@ -316,6 +316,12 @@ module Katello
316
316
  counts.select { |_k, v| v > 1 }.keys
317
317
  end
318
318
 
319
+ def check_non_composite_components
320
+ if !composite? && components.present?
321
+ errors.add(:base, _("Cannot add component versions to a non-composite content view"))
322
+ end
323
+ end
324
+
319
325
  def check_repo_conflicts
320
326
  duplicate_repositories.each do |repo|
321
327
  versions = components.with_library_repo(repo).uniq.map(&:name).join(", ")
@@ -442,7 +448,7 @@ module Katello
442
448
  name_and_author[:author],
443
449
  self.organization.library.repositories.puppet_type
444
450
  )
445
- puppet_modules << puppet_module
451
+ puppet_modules << puppet_module if puppet_module
446
452
  end
447
453
  end
448
454
 
@@ -476,7 +482,7 @@ module Katello
476
482
  def check_remove_from_environment!(env)
477
483
  errors = []
478
484
 
479
- dependencies = {systems: _("systems"),
485
+ dependencies = {hosts: _("hosts"),
480
486
  activation_keys: _("activation keys")
481
487
  }
482
488
 
@@ -495,7 +501,7 @@ module Katello
495
501
  errors = []
496
502
 
497
503
  dependencies = {environments: _("environments"),
498
- systems: _("systems"),
504
+ hosts: _("hosts"),
499
505
  activation_keys: _("activation keys")
500
506
  }
501
507
 
@@ -14,9 +14,6 @@ module Katello
14
14
  private
15
15
 
16
16
  def content_view_types
17
- unless content_view.composite?
18
- errors.add(:base, _("Cannot add component versions to a non-composite content view"))
19
- end
20
17
  if content_view_version.content_view.composite?
21
18
  errors.add(:base, _("Cannot add composite versions to a composite content view"))
22
19
  end
@@ -30,8 +30,8 @@ module Katello
30
30
  self.environment
31
31
  end
32
32
 
33
- def systems
34
- content_view.systems.in_environment(environment)
33
+ def hosts
34
+ ::Host.in_content_view_environment(:content_view => self.content_view, :lifecycle_environment => self.environment)
35
35
  end
36
36
 
37
37
  def activation_keys
@@ -9,6 +9,19 @@ module Katello
9
9
 
10
10
  validates_lengths_from_database
11
11
  validates :name, :presence => true
12
+ validate :ensure_unique_attributes
12
13
  validates_with Validators::ContentViewFilterVersionValidator
14
+
15
+ def ensure_unique_attributes
16
+ other = self.class.where(:name => self.name,
17
+ :version => self.version,
18
+ :content_view_filter_id => self.content_view_filter_id,
19
+ :min_version => self.min_version,
20
+ :max_version => self.max_version)
21
+ other = other.where.not(:id => self.id) if self.id
22
+ if other.exists?
23
+ errors.add(:base, "This package filter rule already exists.")
24
+ end
25
+ end
13
26
  end
14
27
  end
@@ -67,10 +67,10 @@ module Katello
67
67
  self.environment.nil?
68
68
  end
69
69
 
70
- def generate_puppet_path
70
+ def generate_puppet_path(capsule)
71
71
  # rubocop:disable Style/EmptyElse
72
72
  if self.environment
73
- File.join(SETTINGS[:katello][:puppet_repo_root], generate_puppet_env_name, 'modules')
73
+ File.join(capsule.puppet_path, generate_puppet_env_name, 'modules')
74
74
  else
75
75
  nil #don't generate archived content view puppet environments
76
76
  end
@@ -4,7 +4,8 @@ module Katello
4
4
 
5
5
  ALLOWED_REPOSITORY_TYPES = [Repository::YUM_TYPE,
6
6
  Repository::DOCKER_TYPE,
7
- Repository::OSTREE_TYPE
7
+ Repository::OSTREE_TYPE,
8
+ Repository::FILE_TYPE
8
9
  ].freeze
9
10
 
10
11
  belongs_to :content_view, :inverse_of => :content_view_repositories,
@@ -41,6 +41,9 @@ module Katello
41
41
 
42
42
  scope :default_view, -> { joins(:content_view).where("#{Katello::ContentView.table_name}.default" => true) }
43
43
  scope :non_default_view, -> { joins(:content_view).where("#{Katello::ContentView.table_name}.default" => false) }
44
+ scope :with_organization_id, ->(organization_id) do
45
+ joins(:content_view).where("#{Katello::ContentView.table_name}.organization_id" => organization_id)
46
+ end
44
47
 
45
48
  scoped_search :on => :content_view_id, :only_explicit => true
46
49
  scoped_search :on => :major, :rename => :version, :complete_value => true, :ext_method => :find_by_version
@@ -81,7 +84,7 @@ module Katello
81
84
 
82
85
  def self.with_puppet_module(puppet_module)
83
86
  joins(:content_view_puppet_environments)
84
- .where("#{Katello::ContentViewPuppetEnvironment.table_name}.id = ?", puppet_module.content_view_puppet_environments)
87
+ .where("#{Katello::ContentViewPuppetEnvironment.table_name}.id" => puppet_module.content_view_puppet_environments)
85
88
  end
86
89
 
87
90
  def to_s
@@ -177,7 +180,7 @@ module Katello
177
180
  end
178
181
 
179
182
  def deletable?(from_env)
180
- !System.exists?(:environment_id => from_env, :content_view_id => self.content_view) ||
183
+ ::Host.in_content_view_environment(self.content_view, from_env).empty? ||
181
184
  self.content_view.versions.in_environment(from_env).count > 1
182
185
  end
183
186
 
@@ -216,6 +219,10 @@ module Katello
216
219
  Katello::Rpm.in_repositories(self.repositories.archived).count
217
220
  end
218
221
 
222
+ def file_count
223
+ Katello::FileUnit.in_repositories(self.repositories.archived).count
224
+ end
225
+
219
226
  def ostree_branch_count
220
227
  ostree_branches.count
221
228
  end
@@ -76,10 +76,6 @@ module Katello
76
76
  where("#{Katello::ContentFacetRepository.table_name}.repository_id = #{Katello::RepositoryErratum.table_name}.repository_id").uniq
77
77
  end
78
78
 
79
- def hosts_unavailable
80
- self.hosts_applicable.where("#{Katello::System.table_name}.id not in (#{self.hosts_available.select("#{Katello::System.table_name}.id").to_sql})")
81
- end
82
-
83
79
  def self.installable_for_hosts(hosts = nil)
84
80
  query = Katello::Erratum.joins(:content_facet_errata).joins(:repository_errata).
85
81
  joins("INNER JOIN #{Katello::ContentFacetRepository.table_name} on \
@@ -94,7 +90,7 @@ module Katello
94
90
 
95
91
  def update_from_json(json)
96
92
  keys = %w(title id severity issued type description reboot_suggested solution updated summary)
97
- custom_json = json.clone.delete_if { |key, _value| !keys.include?(key) }
93
+ custom_json = json.slice(*keys)
98
94
 
99
95
  if self.updated.blank? || (custom_json['updated'].to_datetime != self.updated.to_datetime)
100
96
  custom_json['errata_id'] = custom_json.delete('id')
@@ -0,0 +1,41 @@
1
+ module Katello
2
+ class FileUnit < Katello::Model
3
+ include Concerns::PulpDatabaseUnit
4
+
5
+ self.table_name = 'katello_files'
6
+
7
+ CONTENT_TYPE = Pulp::FileUnit::CONTENT_TYPE
8
+
9
+ has_many :repositories, :through => :repository_files, :class_name => "Katello::Repository"
10
+ has_many :repository_files, :class_name => "Katello::RepositoryFile", :dependent => :destroy, :inverse_of => :file, :foreign_key => :file_id
11
+
12
+ scoped_search :on => :name, :complete_value => true
13
+ scoped_search :on => :path, :complete_value => true
14
+ scoped_search :on => :checksum
15
+ scoped_search :in => :repositories, :on => :name, :rename => :repository, :complete_value => true
16
+
17
+ def self.default_sort
18
+ order(:name)
19
+ end
20
+
21
+ def self.repository_association_class
22
+ RepositoryFile
23
+ end
24
+
25
+ def self.unit_id_field
26
+ 'file_id'
27
+ end
28
+
29
+ def update_from_json(json)
30
+ custom_json = {}
31
+ custom_json['checksum'] = json['checksum']
32
+ custom_json['path'] = json['name']
33
+ custom_json['name'] = File.basename(json['name'])
34
+ self.update_attributes!(custom_json)
35
+ end
36
+
37
+ def self.total_for_repositories(repos)
38
+ self.in_repositories(repos).uniq.count
39
+ end
40
+ end
41
+ end
@@ -47,7 +47,7 @@ module Katello
47
47
  end
48
48
 
49
49
  def subscribe(pool_id, quantity = 1)
50
- pool = Katello::Pool.find(pool_id)
50
+ pool = Katello::Pool.with_identifier(pool_id)
51
51
  subscription = pool.subscription
52
52
  add_custom_product(subscription.product_id) unless subscription.redhat?
53
53
  Resources::Candlepin::ActivationKey.add_pools self.cp_id, pool.cp_id, quantity
@@ -56,7 +56,7 @@ module Katello
56
56
 
57
57
  def unsubscribe(pool_id)
58
58
  fail _("Subscription id is nil.") unless pool_id
59
- pool = Katello::Pool.find(pool_id)
59
+ pool = Katello::Pool.with_identifier(pool_id)
60
60
  subscription = pool.subscription
61
61
  remove_custom_product(subscription.product_id) unless subscription.redhat?
62
62
  Resources::Candlepin::ActivationKey.remove_pools self.cp_id, pool.cp_id
@@ -81,6 +81,15 @@ module Katello
81
81
  self.class.candlepin_data(self.cp_id)
82
82
  end
83
83
 
84
+ def stacking_subscription(org_label, stacking_id)
85
+ subscription = ::Katello::Subscription.find_by(:product_id => stacking_id)
86
+ if subscription.nil?
87
+ found_product = ::Katello::Resources::Candlepin::Product.find_for_stacking_id(org_label, stacking_id)
88
+ subscription = ::Katello::Subscription.find_by(:product_id => found_product['id']) if found_product
89
+ end
90
+ subscription
91
+ end
92
+
84
93
  def import_data
85
94
  pool_attributes = {}
86
95
  pool_json = self.backend_data
@@ -88,13 +97,13 @@ module Katello
88
97
 
89
98
  product_attributes.map { |attr| pool_attributes[attr["name"].underscore.to_sym] = attr["value"] }
90
99
 
91
- if !pool_json["sourceStackId"].nil?
92
- subscription = ::Katello::Subscription.where(:product_id => pool_json["sourceStackId"])
100
+ if pool_json["sourceStackId"]
101
+ subscription = stacking_subscription(pool_json['owner']['key'], pool_json["sourceStackId"])
93
102
  else
94
- subscription = ::Katello::Subscription.where(:cp_id => pool_json["subscriptionId"])
103
+ subscription = ::Katello::Subscription.find_by(:cp_id => pool_json["subscriptionId"])
95
104
  end
96
105
 
97
- pool_attributes[:subscription_id] = subscription.first.id if subscription.any?
106
+ pool_attributes[:subscription_id] = subscription.id if subscription
98
107
 
99
108
  %w(accountNumber contractNumber quantity startDate endDate accountNumber consumed).each do |json_attribute|
100
109
  pool_attributes[json_attribute.underscore] = pool_json[json_attribute]
@@ -120,8 +129,10 @@ module Katello
120
129
  self.create_activation_key_associations
121
130
  end
122
131
 
123
- def systems
124
- System.all_by_pool(cp_id)
132
+ def hosts
133
+ entitlements = Resources::Candlepin::Pool.entitlements(self.cp_id)
134
+ uuids = entitlements.map { |ent| ent["consumer"]["uuid"] }
135
+ ::Host.where(:id => Katello::Host::SubscriptionFacet.where(:uuid => uuids).pluck(:host_id))
125
136
  end
126
137
 
127
138
  def create_activation_key_associations
@@ -135,14 +146,8 @@ module Katello
135
146
  end
136
147
  end
137
148
 
138
- def host
139
- System.find_by(:uuid => host_id) if host_id
140
- end
141
-
142
- def hosts
143
- entitlements = Resources::Candlepin::Entitlement.get
144
- uuids = entitlements.delete_if { |ent| ent["pool"]["id"] != cp_id }.map { |ent| ent["consumer"]["uuid"] }
145
- ::Host.where(:id => Katello::Host::ContentFacet.where(:uuid => uuids).pluck(:host_id))
149
+ def hypervisor
150
+ ::Katello::Host::SubscriptionFacet.find_by(:uuid => host_id).try(:host) if host_id
146
151
  end
147
152
  end
148
153
  end
@@ -149,7 +149,7 @@ module Katello
149
149
  def docker_feed_url(capsule = false)
150
150
  pulp_uri = URI.parse(SETTINGS[:katello][:pulp][:url])
151
151
  if capsule
152
- "https://#{pulp_uri.host.downcase}:5000"
152
+ "https://#{pulp_uri.host.downcase}:#{Setting['pulp_docker_registry_port']}"
153
153
  else
154
154
  self.url if self.respond_to?(:url)
155
155
  end
@@ -199,10 +199,11 @@ module Katello
199
199
  :ssl_ca_cert => nil
200
200
  }
201
201
  end
202
+ importer_options.merge!(:ssl_validation => verify_ssl_on_sync?) unless self.is_a?(::Katello::ContentViewPuppetEnvironment)
202
203
  importer_options
203
204
  end
204
205
 
205
- def generate_distributors(capsule = false)
206
+ def generate_distributors(capsule = nil)
206
207
  case self.content_type
207
208
  when Repository::YUM_TYPE
208
209
  yum_dist_id = self.pulp_id
@@ -222,7 +223,7 @@ module Katello
222
223
  distributors = [dist]
223
224
  when Repository::PUPPET_TYPE
224
225
  dist_options = { :id => self.pulp_id, :auto_publish => true }
225
- repo_path = File.join(SETTINGS[:katello][:puppet_repo_root],
226
+ repo_path = File.join(capsule.puppet_path,
226
227
  Environment.construct_name(self.organization,
227
228
  self.environment,
228
229
  self.content_view),
@@ -301,6 +302,10 @@ module Katello
301
302
  Katello.pulp_server.extensions.repository.rpm_ids(self.pulp_id)
302
303
  end
303
304
 
305
+ def pulp_file_ids
306
+ Katello.pulp_server.extensions.repository.file_ids(self.pulp_id)
307
+ end
308
+
304
309
  def pulp_errata_ids
305
310
  Katello.pulp_server.extensions.repository.errata_ids(self.pulp_id)
306
311
  end
@@ -373,6 +378,20 @@ module Katello
373
378
  Katello::Rpm.sync_repository_associations(self, pulp_rpm_ids)
374
379
  end
375
380
 
381
+ def index_db_files(force = false)
382
+ if self.content_view.default? || force
383
+ files_json.each do |file_json|
384
+ begin
385
+ file = ::Katello::FileUnit.where(:uuid => file_json['_id']).first_or_create
386
+ rescue ActiveRecord::RecordNotUnique
387
+ retry
388
+ end
389
+ file.update_from_json(file_json)
390
+ end
391
+ end
392
+ Katello::FileUnit.sync_repository_associations(self, pulp_file_ids)
393
+ end
394
+
376
395
  def index_db_puppet_modules(force = false)
377
396
  if self.content_view.default? || force
378
397
  puppet_modules_json.each do |puppet_module_json|
@@ -434,6 +453,19 @@ module Katello
434
453
  tmp_packages
435
454
  end
436
455
 
456
+ def files_json
457
+ tmp_packages = []
458
+ self.pulp_file_ids.each_slice(SETTINGS[:katello][:pulp][:bulk_load_size]) do |sub_list|
459
+ tmp_packages.concat(
460
+ Katello.pulp_server.extensions.file.find_all_by_unit_ids(
461
+ sub_list,
462
+ ::Katello::Pulp::FileUnit::PULP_INDEXED_FIELDS
463
+ )
464
+ )
465
+ end
466
+ tmp_packages
467
+ end
468
+
437
469
  def index_db_docker_manifests
438
470
  docker_manifests_json.each do |manifest_json|
439
471
  manifest = DockerManifest.where(:uuid => manifest_json[:_id]).first_or_create
@@ -455,9 +487,10 @@ module Katello
455
487
  tag = unit_search(:type_ids => [Runcible::Extensions::DockerTag.content_type],
456
488
  :filters => { :unit => { :manifest_digest => manifest.digest,
457
489
  :name => tag_name } }).first
458
-
459
- DockerTag.where(:repository_id => id, :docker_manifest_id => manifest.id,
460
- :name => tag[:metadata][:name], :uuid => tag[:metadata][:_id]).first_or_create
490
+ if tag
491
+ DockerTag.where(:repository_id => id, :docker_manifest_id => manifest.id,
492
+ :name => tag[:metadata][:name], :uuid => tag[:metadata][:_id]).first_or_create
493
+ end
461
494
  end
462
495
 
463
496
  def package_group_categories(search_args = {})
@@ -515,7 +548,7 @@ module Katello
515
548
  end
516
549
 
517
550
  def pulp_update_needed?
518
- changeable_attributes = %w(url unprotected checksum_type docker_upstream_name download_policy mirror_on_sync)
551
+ changeable_attributes = %w(url unprotected checksum_type docker_upstream_name download_policy mirror_on_sync verify_ssl_on_sync)
519
552
  changeable_attributes << "name" if docker?
520
553
  changeable_attributes.any? { |key| previous_changes.key?(key) }
521
554
  end
@@ -768,8 +801,8 @@ module Katello
768
801
  end
769
802
  end
770
803
 
771
- def distributors_match?(capsule_distributors)
772
- generated_distributor_configs = self.generate_distributors(true)
804
+ def distributors_match?(capsule_distributors, capsule)
805
+ generated_distributor_configs = self.generate_distributors(capsule)
773
806
  generated_distributor_configs.all? do |gen_dist|
774
807
  type = gen_dist.class.type_id
775
808
  found_on_capsule = capsule_distributors.find { |dist| dist['distributor_type_id'] == type }
@@ -827,7 +860,7 @@ module Katello
827
860
  pulp_uri = URI.parse(smart_proxy ? smart_proxy.url : SETTINGS[:katello][:pulp][:url])
828
861
  scheme = (self.unprotected && !force_https) ? 'http' : 'https'
829
862
  if docker?
830
- "#{pulp_uri.host.downcase}:5000/#{pulp_id}"
863
+ "#{pulp_uri.host.downcase}:#{Setting['pulp_docker_registry_port']}/#{pulp_id}"
831
864
  elsif file?
832
865
  "#{scheme}://#{pulp_uri.host.downcase}/pulp/isos/#{pulp_id}/"
833
866
  elsif puppet?
@@ -847,6 +880,7 @@ module Katello
847
880
  self.index_db_package_groups
848
881
  self.index_db_ostree_branches if Katello::RepositoryTypeManager.find(Repository::OSTREE_TYPE).present?
849
882
  self.import_distribution_data
883
+ self.index_db_files
850
884
  true
851
885
  end
852
886
  end