katello 3.3.0.rc1.1 → 3.3.0.rc2

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 (155) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +2 -2
  3. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +8 -1
  4. data/app/controllers/katello/api/v2/content_views_controller.rb +30 -7
  5. data/app/controllers/katello/api/v2/host_contents_controller.rb +1 -0
  6. data/app/controllers/katello/products_controller.rb +9 -10
  7. data/app/controllers/katello/providers_controller.rb +3 -2
  8. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +48 -24
  9. data/app/lib/actions/katello/repository/clear.rb +2 -1
  10. data/app/lib/actions/katello/repository/clone_docker_content.rb +13 -7
  11. data/app/lib/actions/katello/repository/clone_to_environment.rb +1 -1
  12. data/app/lib/actions/katello/repository/clone_to_version.rb +1 -1
  13. data/app/lib/katello/util/docker_manifest_clause_generator.rb +44 -0
  14. data/app/lib/katello/util/package_filter.rb +24 -5
  15. data/app/models/katello/concerns/content_facet_host_extensions.rb +3 -1
  16. data/app/models/katello/concerns/host_managed_extensions.rb +0 -7
  17. data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -1
  18. data/app/models/katello/content_view_docker_filter.rb +37 -0
  19. data/app/models/katello/content_view_docker_filter_rule.rb +23 -0
  20. data/app/models/katello/content_view_filter.rb +17 -4
  21. data/app/models/katello/content_view_puppet_environment.rb +6 -0
  22. data/app/models/katello/content_view_puppet_module.rb +5 -0
  23. data/app/models/katello/docker_manifest.rb +1 -1
  24. data/app/models/katello/glue/pulp/repo.rb +1 -1
  25. data/app/models/katello/host/content_facet.rb +2 -0
  26. data/app/views/dashboard/_content_views_widget.html.erb +1 -1
  27. data/app/views/dashboard/_subscription_status_widget.html.erb +1 -1
  28. data/app/views/dashboard/_subscription_widget.html.erb +1 -1
  29. data/app/views/foreman/job_templates/install_errata.erb +1 -1
  30. data/app/views/foreman/unattended/kickstart-katello-atomic.erb +10 -1
  31. data/app/views/foreman/unattended/kickstart-katello.erb +1 -1
  32. data/app/views/katello/api/v2/content_facet/base.json.rabl +5 -0
  33. data/app/views/katello/api/v2/content_facet/show.json.rabl +1 -1
  34. data/app/views/katello/api/v2/content_view_filters/base.json.rabl +5 -0
  35. data/app/views/katello/api/v2/docker_tags/show.json.rabl +1 -1
  36. data/app/views/katello/api/v2/gpg_keys/show.json.rabl +2 -4
  37. data/app/views/katello/providers/redhat/_repos.html.erb +4 -0
  38. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +12 -10
  39. data/db/migrate/20160924213020_change_katello_widget_names.rb +21 -0
  40. data/db/migrate/20161102194100_create_content_view_docker_filter_rules.rb +13 -0
  41. data/db/migrate/20161214151548_move_content_source_id_to_content_facets.rb +38 -0
  42. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +11 -6
  43. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-view.factory.js +9 -10
  44. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.controller.js +1 -5
  45. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +349 -221
  46. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-deletion.controller.js +5 -14
  47. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-activation-keys.controller.js +2 -2
  48. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-confirm.controller.js +8 -5
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion-content-hosts.controller.js +2 -2
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/content-view-version-deletion.controller.js +5 -5
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/content-view-deletion.html +12 -17
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-activation-keys.html +3 -5
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-confirm.html +1 -3
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-content-hosts.html +67 -71
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-environments.html +1 -3
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/content-view-composite-available-content-views.controller.js +3 -2
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/content-view-composite-content-views-list.controller.js +2 -1
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-available-content-views.html +19 -15
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite-content-views-list.html +65 -63
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/components/views/content-view-composite.html +4 -4
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-docker-repositories.controller.js +2 -2
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-file-repositories.controller.js +1 -1
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-ostree-repositories.controller.js +2 -2
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-available-repositories.controller.js +1 -1
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +8 -124
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-docker-repositories-list.controller.js +29 -20
  67. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-file-repositories-list.controller.js +1 -1
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-ostree-repositories-list.controller.js +29 -20
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-promotion.controller.js +6 -5
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-publish.controller.js +4 -3
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-repositories-list.controller.js +1 -1
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-repositories.service.js +1 -1
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-versions.controller.js +133 -25
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/available-errata-filter.controller.js +6 -5
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/available-package-group-filter.controller.js +8 -5
  76. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/date-type-errata-filter.controller.js +6 -3
  77. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/edit-filter.controller.js +4 -6
  78. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter-list.controller.js +6 -5
  79. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/errata-filter.controller.js +0 -4
  80. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filter-repositories.controller.js +11 -10
  81. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/filters.controller.js +11 -9
  82. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/new-filter.controller.js +7 -6
  83. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/package-filter.controller.js +8 -8
  84. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/package-group-list-filter.controller.js +6 -5
  85. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/date-type-errata-filter.html +1 -3
  86. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/edit-filter.html +0 -1
  87. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter-details.html +16 -21
  88. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/errata-filter.html +10 -10
  89. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-details.html +5 -45
  90. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-repositories.html +98 -104
  91. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filters.html +12 -21
  92. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/new-filter.html +53 -62
  93. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter-details.html +187 -179
  94. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-filter.html +26 -35
  95. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-group-filter-details.html +10 -13
  96. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/package-group-filter.html +8 -11
  97. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/content-view-history.controller.js +1 -1
  98. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/histories/views/content-view-history.html +9 -7
  99. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/content-view-puppet-module-names.controller.js +3 -3
  100. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/content-view-puppet-module-versions.controller.js +15 -21
  101. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/content-view-puppet-modules.controller.js +8 -9
  102. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-module-names.html +28 -41
  103. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-module-versions.html +31 -28
  104. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/puppet-modules/views/content-view-puppet-modules.html +6 -9
  105. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-copy.html +18 -0
  106. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details-tasks.html +1 -3
  107. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-details.html +133 -160
  108. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-docker-repositories.html +40 -64
  109. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-file-repositories.html +78 -110
  110. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-info.html +29 -36
  111. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-ostree-repositories.html +78 -110
  112. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-promotion.html +1 -7
  113. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-publish.html +32 -36
  114. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-repositories.html +93 -123
  115. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-versions.html +71 -75
  116. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/content-view-new.controller.js +2 -3
  117. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +16 -20
  118. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/content-view-version-content.controller.js +1 -1
  119. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-components.html +3 -9
  120. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-docker.html +2 -7
  121. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-errata.html +39 -44
  122. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-file.html +2 -7
  123. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-ostree-branches.html +2 -6
  124. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-package-groups.html +8 -13
  125. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-packages.html +2 -7
  126. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-puppet-modules.html +2 -7
  127. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version-yum.html +2 -7
  128. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/versions/views/content-view-version.html +60 -75
  129. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views.html +50 -5
  130. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/docker-tag-details.controller.js +1 -1
  131. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tag-environments.html +9 -1
  132. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/details/views/environment-content-views.html +1 -1
  133. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/apply-errata-confirm.html +2 -2
  134. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-details.html +3 -13
  135. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-details.html +9 -4
  136. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-details.html +9 -3
  137. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +17 -13
  138. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/puppet-modules/details/views/puppet-modules-details-content-views.html +1 -1
  139. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-details.html +8 -3
  140. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/tasks-table.directive.js +2 -2
  141. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/tasks-index.html +1 -1
  142. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/tasks-table.html +35 -34
  143. data/engines/bastion_katello/app/assets/stylesheets/bastion_katello/tasks.scss +0 -8
  144. data/lib/katello/engine.rb +7 -0
  145. data/lib/katello/plugin.rb +9 -8
  146. data/lib/katello/tasks/clean_published_repo_directories.rake +52 -0
  147. data/lib/katello/tasks/reimport.rake +2 -1
  148. data/lib/katello/tasks/upgrades/2.4/import_puppet_modules.rake +1 -0
  149. data/lib/katello/tasks/upgrades/3.0/update_subscription_facet_backend_data.rake +1 -1
  150. data/lib/katello/version.rb +1 -1
  151. metadata +11 -7
  152. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-breadcrumb.html +0 -18
  153. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/package-group-filter.controller.js +0 -16
  154. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views-table-collapsed.html +0 -21
  155. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/views/content-views-table-full.html +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27da4eecf491c4840dd61deabbd4b3bb50b73966
4
- data.tar.gz: 45131f798de1ce8b61ef5edf8c0925a3696e90d0
3
+ metadata.gz: 8e71d2d24ee870d0c10c9aef24333f76d6ba6cd9
4
+ data.tar.gz: fb29c9754551fe3fe1cb49e989dabdb47d732f74
5
5
  SHA512:
6
- metadata.gz: 9e4bb933214d3fbb655d65c60edb485b3f719663381dfaddeba4f6d955ffa96379f0ee185c343c64f20da59b57739da5f502e7f5e2c6dbd989485b0321a932b7
7
- data.tar.gz: d0da59d96c218cc220d828ad70593ae9a6477d06ab6b33229c8301d71b51f652a40d0716f0711494d9e8c2ea1ef10cdffce9cd7994314f45b5b12d9ab9cfac2e
6
+ metadata.gz: c9b4d0575247f45221ae2d38ff05921af5e0d7cf0b0b20802d2c05b0f9e365353f0d7309e45586f4f8079cd17b86bb8c100ec6afe7a7de74b82a90cac5162781
7
+ data.tar.gz: c79a34dada9c793960804035c96a4c5f4a01376ef483476eae0edad7d9813f008818c1bcae68e66fd1681e9ece01b205bbe5d9604d83dab65c1fedf7443d1754
@@ -19,7 +19,7 @@ module Katello
19
19
  api :POST, "/content_view_filters/:content_view_filter_id/rules",
20
20
  N_("Create a filter rule. The parameters included should be based upon the filter type.")
21
21
  param :content_view_filter_id, :identifier, :desc => N_("filter identifier"), :required => true
22
- param :name, [String, Array], :desc => N_("package and package group names")
22
+ param :name, [String, Array], :desc => N_("package, package group, or docker tag names")
23
23
  param :version, String, :desc => N_("package: version")
24
24
  param :arch, String, :desc => N_("package: architecture")
25
25
  param :min_version, String, :desc => N_("package: minimum version")
@@ -64,7 +64,7 @@ module Katello
64
64
  N_("Update a filter rule. The parameters included should be based upon the filter type.")
65
65
  param :content_view_filter_id, :identifier, :desc => N_("filter identifier"), :required => true
66
66
  param :id, :identifier, :desc => N_("rule identifier"), :required => true
67
- param :name, String, :desc => N_("package or package group: name")
67
+ param :name, String, :desc => N_("package, package group, or docker tag: name")
68
68
  param :version, String, :desc => N_("package: version")
69
69
  param :min_version, String, :desc => N_("package: minimum version")
70
70
  param :max_version, String, :desc => N_("package: maximum version")
@@ -12,6 +12,7 @@ module Katello
12
12
  param_group :search, Api::V2::ApiController
13
13
  param :content_view_id, :identifier, :desc => N_("content view identifier"), :required => true
14
14
  param :name, String, :desc => N_("filter content view filters by name")
15
+ param :types, Array, :desc => N_("types of filters")
15
16
  def index
16
17
  respond(:collection => scoped_search(index_relation.uniq, :name, :asc))
17
18
  end
@@ -19,6 +20,12 @@ module Katello
19
20
  def index_relation
20
21
  query = ContentViewFilter.where(:content_view_id => (@view || ContentView.readable))
21
22
  query = query.where(:name => params[:name]) if params[:name]
23
+ if params[:types]
24
+ types = params[:types].each.collect do |type|
25
+ ::Katello::ContentViewFilter.class_for(type)
26
+ end
27
+ query = query.where("#{::Katello::ContentViewFilter.table_name}.type IN (?)", types)
28
+ end
22
29
  query
23
30
  end
24
31
 
@@ -26,7 +33,7 @@ module Katello
26
33
  api :post, "/content_view_filters", N_("create a filter for a content view")
27
34
  param :content_view_id, :identifier, :desc => N_("content view identifier"), :required => true
28
35
  param :name, String, :desc => N_("name of the filter"), :required => true
29
- param :type, String, :desc => N_("type of filter (e.g. rpm, package_group, erratum)"), :required => true
36
+ param :type, String, :desc => N_("type of filter (e.g. rpm, package_group, erratum, docker)"), :required => true
30
37
  param :original_packages, :bool, :desc => N_("add all packages without errata to the included/excluded list. " \
31
38
  "(package filter only)")
32
39
  param :inclusion, :bool, :desc => N_("specifies if content should be included or excluded, default: inclusion=false")
@@ -92,17 +92,28 @@ module Katello
92
92
  param :id, :identifier, :desc => N_("content view numeric identifier"), :required => true
93
93
  param :name, String, :desc => N_("module name to restrict modules for"), :required => false
94
94
  def available_puppet_modules
95
- current_uuids = @view.content_view_puppet_modules.where("uuid is NOT NULL").pluck(:uuid)
95
+ current_cv_puppet_modules = @view.content_view_puppet_modules.where("uuid is NOT NULL")
96
+ current_uuids = current_cv_puppet_modules.pluck(:uuid)
96
97
  repositories = @view.organization.library.puppet_repositories
97
-
98
98
  query = PuppetModule.in_repositories(repositories)
99
- query = query.where(:name => params[:name]) if params[:name]
99
+ selected_latest_versions = []
100
+ if params[:name]
101
+ query = query.where(:name => params[:name])
102
+ if current_uuids.present?
103
+ module_by_name = current_cv_puppet_modules.find_by(:name => params[:name])
104
+ if module_by_name && module_by_name.latest_in_modules_by_author?(query)
105
+ current_uuids.delete(module_by_name.uuid)
106
+ selected_latest_versions.push(module_by_name.uuid)
107
+ end
108
+ end
109
+ end
100
110
  query = query.where("#{PuppetModule.table_name}.uuid NOT in (?)", current_uuids) if current_uuids.present?
101
111
  custom_sort = ->(sort_query) { sort_query.order('author, name, sortable_version DESC') }
102
-
103
- respond_for_index :template => 'puppet_modules',
104
- :collection => scoped_search(query, nil, nil, :resource_class => PuppetModule,
105
- :custom_sort => custom_sort)
112
+ sorted_records = scoped_search(query, nil, nil, :resource_class => PuppetModule, :custom_sort => custom_sort)
113
+ if params[:name]
114
+ sorted_records[:results] = add_use_latest_records(sorted_records[:results].to_a, selected_latest_versions)
115
+ end
116
+ respond_for_index :template => 'puppet_modules', :collection => sorted_records
106
117
  end
107
118
 
108
119
  api :GET, "/content_views/:id/available_puppet_module_names",
@@ -200,5 +211,17 @@ module Katello
200
211
  return if !params.key?(:environment_id) && params[:action] == "index"
201
212
  @environment = KTEnvironment.find(params[:environment_id])
202
213
  end
214
+
215
+ def add_use_latest_records(module_records, selected_latest_versions)
216
+ module_records.group_by(&:author).each_pair do |_author, records|
217
+ top_rec = records[0]
218
+ latest = top_rec.dup
219
+ latest.version = _("Always Use Latest (currently %{version})") % { version: latest.version }
220
+ latest.uuid = nil
221
+ module_records.delete(top_rec) if selected_latest_versions.include?(top_rec.uuid)
222
+ module_records.push(latest)
223
+ end
224
+ module_records
225
+ end
203
226
  end
204
227
  end
@@ -3,6 +3,7 @@ module Katello
3
3
  def_param_group :content_facet_attributes do
4
4
  param :content_view_id, Integer
5
5
  param :lifecycle_environment_id, Integer
6
+ param :content_source_id, Integer
6
7
  param :kickstart_repository_id, Integer, :desc => N_("Repository Id associated with the kickstart repo used for provisioning")
7
8
  end
8
9
  end
@@ -17,15 +17,14 @@ module Katello
17
17
  render_bad_parameters _('Repository sets are not available for custom products.')
18
18
  else
19
19
  task = sync_task(::Actions::Katello::RepositorySet::ScanCdn, @product, params[:content_id])
20
- if task.result == 'warning'
21
- render :partial => 'katello/providers/redhat/errors', :locals => { :error_message => task_error(task), :task => task}
22
- else
23
- repos = task.output[:results]
24
- repos = exclude_rolling_kickstart_repos(repos)
25
- repos = available_synced_repos(repos) if params[:orphaned]
26
20
 
27
- render :partial => 'katello/providers/redhat/repos', :locals => {:scan_cdn => task, :repos => repos}
28
- end
21
+ repos = task.output[:results]
22
+ repos = exclude_rolling_kickstart_repos(repos)
23
+ repos = available_synced_repos(repos, params[:content_id])
24
+
25
+ locals = {:scan_cdn => task, :repos => repos, :error_message => nil}
26
+ locals[:error_message => task_error(task)] if task.result == 'warning'
27
+ render :partial => 'katello/providers/redhat/repos', :locals => locals
29
28
  end
30
29
  end
31
30
 
@@ -80,8 +79,8 @@ module Katello
80
79
  end
81
80
  end
82
81
 
83
- def available_synced_repos(repos)
84
- @product.repositories.each do |product_repo|
82
+ def available_synced_repos(repos, content_id)
83
+ @product.repositories.in_default_view.where(:content_id => content_id).find_each do |product_repo|
85
84
  found = repos.detect do |repo|
86
85
  product_repo.pulp_id == repo[:pulp_id]
87
86
  end
@@ -24,8 +24,9 @@ module Katello
24
24
  subscription_product_ids += sub['derivedProvidedProducts'].map { |p| p['id'] } if sub['derivedProvidedProducts']
25
25
  end
26
26
 
27
- orphaned_product_ids = current_organization.redhat_provider.products.
28
- where("cp_id not in (?)", subscription_product_ids).pluck(:id)
27
+ orphaned_products = current_organization.redhat_provider.products
28
+ orphaned_products = orphaned_products.where("cp_id not in (?)", subscription_product_ids) if subscription_product_ids.any?
29
+ orphaned_product_ids = orphaned_products.pluck(:id)
29
30
 
30
31
  render :partial => "katello/providers/redhat/tab",
31
32
  :locals => { :tab_id => params[:tab], :orphaned_product_ids => orphaned_product_ids }
@@ -14,14 +14,6 @@ module Katello
14
14
  %(<option data-id="#{inherited_value}" value="">#{blank_or_inherit_f(f, attr)}</option>)
15
15
  end
16
16
 
17
- def envs_by_kt_org
18
- ::Environment.all.find_all(&:katello_id).group_by do |env|
19
- if env.katello_id
20
- env.katello_id.split('/').first
21
- end
22
- end
23
- end
24
-
25
17
  def content_view(host)
26
18
  if host.is_a?(Hostgroup)
27
19
  host.content_view
@@ -30,6 +22,14 @@ module Katello
30
22
  end
31
23
  end
32
24
 
25
+ def organizations(host)
26
+ if host.is_a?(Hostgroup)
27
+ host.organizations
28
+ else
29
+ host.organization ? [host.organization] : []
30
+ end
31
+ end
32
+
33
33
  def lifecycle_environment(host)
34
34
  if host.is_a?(Hostgroup)
35
35
  host.lifecycle_environment
@@ -91,26 +91,49 @@ module Katello
91
91
  selected_content_view if selected_content_view.present?
92
92
  end
93
93
 
94
+ def accessible_lifecycle_environments(org, host)
95
+ selected = lifecycle_environment(host)
96
+ envs = org.kt_environments.readable
97
+ envs |= [selected] if selected.present? && org == selected.organization
98
+ envs
99
+ end
100
+
101
+ def accessible_content_proxies(obj)
102
+ list = accessible_resource_records(:smart_proxy).with_content.to_a
103
+ current = obj.content_source
104
+ list |= [current] if current.present?
105
+ list
106
+ end
107
+
108
+ def relevant_organizations(host)
109
+ host_orgs = organizations(host)
110
+ if Organization.current
111
+ [Organization.current]
112
+ elsif host_orgs.present?
113
+ host_orgs
114
+ else
115
+ Organization.my_organizations
116
+ end
117
+ end
118
+
94
119
  def lifecycle_environment_options(host, options = {})
95
120
  include_blank = options.fetch(:include_blank, nil)
96
- if include_blank == true #check for true specifically
97
- include_blank = '<option></option>'
98
- end
99
- selected_id = fetch_lifecycle_environment(host, options).try(:id)
121
+ include_blank = '<option></option>' if include_blank == true #check for true specifically
100
122
 
101
- orgs = Organization.current ? [Organization.current] : Organization.my_organizations
123
+ selected_id = fetch_lifecycle_environment(host, options).try(:id)
124
+ orgs = relevant_organizations(host)
102
125
  all_options = []
103
126
  orgs.each do |org|
104
127
  env_options = ""
105
- org.kt_environments.each do |env|
128
+ accessible_lifecycle_environments(org, host).each do |env|
106
129
  selected = selected_id == env.id ? 'selected' : ''
107
130
  env_options << %(<option value="#{env.id}" class="kt-env" #{selected}>#{h(env.name)}</option>)
108
131
  end
109
132
 
110
- if Organization.current
111
- all_options << env_options
112
- else
133
+ if orgs.count > 1
113
134
  all_options << %(<optgroup label="#{org.name}">#{env_options}</optgroup>)
135
+ else
136
+ all_options << env_options
114
137
  end
115
138
  end
116
139
 
@@ -129,7 +152,8 @@ module Katello
129
152
 
130
153
  views = []
131
154
  if lifecycle_environment
132
- views = Katello::ContentView.in_environment(lifecycle_environment)
155
+ views = Katello::ContentView.in_environment(lifecycle_environment).readable
156
+ views |= [content_view] if content_view.present? && content_view.in_environment?(lifecycle_environment)
133
157
  elsif content_view
134
158
  views = [content_view]
135
159
  end
@@ -180,13 +204,13 @@ module Katello
180
204
 
181
205
  if (host.is_a? Hostgroup)
182
206
  new_host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => host.lifecycle_environment_id,
183
- :content_view_id => host.content_view_id)
207
+ :content_view_id => host.content_view_id,
208
+ :content_source_id => host.content_source_id)
184
209
  elsif host.content_facet.present?
185
210
  new_host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => host.content_facet.lifecycle_environment_id,
186
- :content_view_id => host.content_facet.content_view_id)
211
+ :content_view_id => host.content_facet.content_view_id,
212
+ :content_source_id => host.content_source_id)
187
213
  end
188
-
189
- new_host.content_source = host.content_source
190
214
  new_host.operatingsystem.kickstart_repos(new_host).map { |repo| OpenStruct.new(repo) }
191
215
  else
192
216
  # case 2
@@ -213,8 +237,8 @@ module Katello
213
237
  lifecycle_env = Katello::KTEnvironment.find(host_params[:lifecycle_environment_id])
214
238
  content_view = Katello::ContentView.find(host_params[:content_view_id])
215
239
  host.content_facet = Host::ContentFacet.new(:lifecycle_environment_id => lifecycle_env.id,
216
- :content_view_id => content_view.id)
217
- host.content_source = SmartProxy.find(host_params[:content_source_id])
240
+ :content_view_id => content_view.id,
241
+ :content_source => SmartProxy.find(host_params[:content_source_id]))
218
242
  if host.operatingsystem.is_a?(Redhat)
219
243
  view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
220
244
  end
@@ -8,7 +8,8 @@ module Actions
8
8
  Pulp::Repository::RemovePackageGroup,
9
9
  Pulp::Repository::RemoveDistribution,
10
10
  Pulp::Repository::RemoveFile,
11
- Pulp::Repository::RemovePuppetModule].each do |action_class|
11
+ Pulp::Repository::RemovePuppetModule,
12
+ Pulp::Repository::RemoveDockerManifest].each do |action_class|
12
13
  plan_action(action_class, pulp_id: repo.pulp_id)
13
14
  end
14
15
  end
@@ -2,14 +2,20 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class CloneDockerContent < Actions::Base
5
- def plan(source_repo, target_repo)
5
+ def plan(source_repo, target_repo, filters)
6
+ filters = filters.docker unless filters.is_a? Array
7
+
8
+ if filters.any?
9
+ clause_gen = ::Katello::Util::DockerManifestClauseGenerator.new(source_repo, filters)
10
+ clause_gen.generate
11
+ copy_clauses = clause_gen.copy_clause
12
+ end
13
+
6
14
  sequence do
7
- plan_action(Pulp::Repository::CopyDockerManifest,
8
- source_pulp_id: source_repo.pulp_id,
9
- target_pulp_id: target_repo.pulp_id)
10
- plan_action(Pulp::Repository::CopyDockerTag,
11
- source_pulp_id: source_repo.pulp_id,
12
- target_pulp_id: target_repo.pulp_id)
15
+ if filters.empty? || copy_clauses
16
+ plan_action(Pulp::Repository::CopyDockerTag, source_pulp_id: source_repo.pulp_id,
17
+ target_pulp_id: target_repo.pulp_id, clauses: copy_clauses)
18
+ end
13
19
  plan_action(Katello::Repository::MetadataGenerate, target_repo)
14
20
  plan_action(Katello::Repository::IndexContent, id: target_repo.id)
15
21
  end
@@ -23,7 +23,7 @@ module Actions
23
23
  if repository.yum?
24
24
  plan_action(Repository::CloneYumContent, repository, clone, [], false)
25
25
  elsif repository.docker?
26
- plan_action(Repository::CloneDockerContent, repository, clone)
26
+ plan_action(Repository::CloneDockerContent, repository, clone, [])
27
27
  elsif repository.ostree?
28
28
  plan_action(Repository::CloneOstreeContent, repository, clone)
29
29
  elsif repository.file?
@@ -20,7 +20,7 @@ module Actions
20
20
  plan_action(Repository::CloneYumContent, repository, new_repository, filters, !incremental,
21
21
  :generate_metadata => !incremental, :index_content => !incremental, :simple_clone => incremental)
22
22
  elsif new_repository.docker?
23
- plan_action(Repository::CloneDockerContent, repository, new_repository)
23
+ plan_action(Repository::CloneDockerContent, repository, new_repository, filters)
24
24
  elsif new_repository.ostree?
25
25
  plan_action(Repository::CloneOstreeContent, repository, new_repository)
26
26
  elsif new_repository.file?
@@ -0,0 +1,44 @@
1
+ module Katello
2
+ module Util
3
+ class DockerManifestClauseGenerator
4
+ include Util::FilterClauseGenerator
5
+
6
+ protected
7
+
8
+ def fetch_filters
9
+ ContentViewFilter.docker
10
+ end
11
+
12
+ def collect_clauses(repo, filters)
13
+ [ContentViewDockerFilter].collect do |filter_class|
14
+ content_type_filters = filters.where(:type => filter_class)
15
+ make_manifest_clauses(repo, content_type_filters) unless content_type_filters.empty?
16
+ end
17
+ end
18
+
19
+ def whitelist_non_matcher_clause
20
+ {"name" => {"$not" => {"$exists" => true}}}
21
+ end
22
+
23
+ def whitelist_all_matcher_clause
24
+ {"name" => {"$exists" => true}}
25
+ end
26
+
27
+ def make_manifest_clauses(repo, filters)
28
+ pulp_content_clauses = filters.collect do |filter|
29
+ filter.generate_clauses(repo)
30
+ end
31
+ pulp_content_clauses.flatten!
32
+ pulp_content_clauses.compact!
33
+
34
+ unless pulp_content_clauses.empty?
35
+ manifest_clauses_from_content(pulp_content_clauses)
36
+ end
37
+ end
38
+
39
+ def manifest_clauses_from_content(pulp_content_clauses)
40
+ {"$or" => pulp_content_clauses}
41
+ end
42
+ end
43
+ end
44
+ end
@@ -31,16 +31,35 @@ module Katello
31
31
  end
32
32
 
33
33
  def results
34
- epoch_clause = "epoch #{operator} :epoch OR (epoch = :epoch AND (%s))"
35
34
  version_clause = "#{convert(:version_sortable)} #{operator} #{convert(':version')}"
36
- release_clause = "(#{convert(:version_sortable)} = #{convert(':version')} AND " \
37
- "#{convert(:release_sortable)} #{operator} #{convert(':release')})"
35
+ version_clause = add_release_clause(version_clause) unless release.blank?
36
+ version_clause = add_epoch_clause(version_clause) unless epoch.blank?
38
37
 
39
- version_clause = "#{version_clause} OR #{release_clause}" unless release.blank?
40
- version_clause = epoch_clause % version_clause unless epoch.blank?
41
38
  self.relation.where(version_clause, :version => version, :release => release, :epoch => epoch)
42
39
  end
43
40
 
41
+ def add_release_clause(version_clause)
42
+ clause = "(#{convert(:version_sortable)} = #{convert(':version')} AND #{convert(:release_sortable)} #{operator} #{convert(':release')})"
43
+
44
+ # if we're using EQUAL, match: version = X AND release = Y
45
+ # else if we're using something like greater than, we need:
46
+ # (version > X) OR (version = X AND release > Y)
47
+ if operator == EQUAL
48
+ clause
49
+ else
50
+ "#{version_clause} OR #{clause}"
51
+ end
52
+ end
53
+
54
+ def add_epoch_clause(version_clause)
55
+ if operator == EQUAL
56
+ clause = "(epoch = :epoch AND (%s))"
57
+ else
58
+ clause = "epoch #{operator} :epoch OR (epoch = :epoch AND (%s))"
59
+ end
60
+ clause % version_clause
61
+ end
62
+
44
63
  def convert(name = '?')
45
64
  "convert_to(#{name}, 'SQL_ASCII')"
46
65
  end
@@ -18,6 +18,7 @@ module Katello
18
18
  #associations for simpler scoped searches
19
19
  has_one :content_view, :through => :content_facet
20
20
  has_one :lifecycle_environment, :through => :content_facet
21
+ has_one :content_source, :through => :content_facet
21
22
  has_many :applicable_errata, :through => :content_facet
22
23
  has_many :applicable_rpms, :through => :content_facet
23
24
 
@@ -29,6 +30,7 @@ module Katello
29
30
  scoped_search :in => :applicable_errata, :on => :errata_id, :rename => :installable_errata, :complete_value => true, :ext_method => :find_by_installable_errata, :only_explicit => true
30
31
  scoped_search :in => :applicable_rpms, :on => :nvra, :rename => :applicable_rpms, :complete_value => true, :ext_method => :find_by_applicable_rpms, :only_explicit => true
31
32
  scoped_search :in => :applicable_rpms, :on => :nvra, :rename => :upgradable_rpms, :complete_value => true, :ext_method => :find_by_installable_rpms, :only_explicit => true
33
+ scoped_search :in => :content_source, :on => :name, :complete_value => true, :rename => :content_source
32
34
 
33
35
  # preserve options set by facets framework, but add new :reject_if statement
34
36
  accepts_nested_attributes_for(
@@ -95,5 +97,5 @@ module Katello
95
97
  end
96
98
 
97
99
  class ::Host::Managed::Jail < Safemode::Jail
98
- allow :content_view, :lifecycle_environment
100
+ allow :content_view, :lifecycle_environment, :content_source
99
101
  end