katello 3.4.5 → 3.5.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 (206) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/app/assets/stylesheets/katello/katello.scss +7 -5
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +3 -3
  5. data/app/controllers/katello/api/v2/api_controller.rb +8 -0
  6. data/app/controllers/katello/api/v2/capsule_content_controller.rb +6 -1
  7. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +2 -1
  8. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +1 -1
  9. data/app/controllers/katello/api/v2/content_views_controller.rb +1 -1
  10. data/app/controllers/katello/api/v2/host_collections_controller.rb +1 -1
  11. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +2 -2
  12. data/app/controllers/katello/api/v2/host_tracer_controller.rb +1 -1
  13. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +6 -6
  14. data/app/controllers/katello/api/v2/repositories_controller.rb +6 -7
  15. data/app/controllers/katello/api/v2/repository_sets_controller.rb +25 -4
  16. data/app/controllers/katello/concerns/api/v2/content_overrides_controller.rb +2 -4
  17. data/app/controllers/katello/concerns/api/v2/hostgroups_controller_extensions.rb +10 -27
  18. data/app/controllers/katello/concerns/api/v2/smart_proxies_controller_extensions.rb +10 -14
  19. data/app/controllers/katello/concerns/hosts_controller_extensions.rb +33 -0
  20. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +2 -1
  21. data/app/helpers/katello/organizations_helper.rb +1 -1
  22. data/app/helpers/katello/providers_helper.rb +1 -1
  23. data/app/lib/actions/candlepin/abstract_async_task.rb +1 -1
  24. data/app/lib/actions/candlepin/candlepin_listening_service.rb +17 -6
  25. data/app/lib/actions/candlepin/import_pool_handler.rb +21 -56
  26. data/app/lib/actions/candlepin/listen_on_candlepin_events.rb +1 -0
  27. data/app/lib/actions/candlepin/owner/import_products.rb +1 -3
  28. data/app/lib/actions/candlepin/product/content_create.rb +2 -0
  29. data/app/lib/actions/candlepin/product/content_update.rb +2 -0
  30. data/app/lib/actions/candlepin/product/create.rb +2 -10
  31. data/app/lib/actions/candlepin/product/create_unlimited_subscription.rb +8 -1
  32. data/app/lib/actions/katello/capsule_content/sync.rb +12 -3
  33. data/app/lib/actions/katello/host/attach_subscriptions.rb +1 -1
  34. data/app/lib/actions/katello/host/hypervisors_update.rb +2 -4
  35. data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
  36. data/app/lib/actions/katello/organization/create.rb +2 -2
  37. data/app/lib/actions/katello/organization/manifest_refresh.rb +1 -2
  38. data/app/lib/actions/katello/product/content_create.rb +4 -4
  39. data/app/lib/actions/katello/product/create.rb +13 -11
  40. data/app/lib/actions/katello/repository/sync.rb +0 -1
  41. data/app/lib/actions/katello/repository/update.rb +2 -1
  42. data/app/lib/actions/pulp/consumer/generate_applicability.rb +5 -1
  43. data/app/lib/actions/pulp/repository/create.rb +1 -0
  44. data/app/lib/actions/pulp/repository/create_in_plan.rb +4 -4
  45. data/app/lib/actions/pulp/repository/sync.rb +1 -1
  46. data/app/lib/katello/http_resource.rb +1 -1
  47. data/app/lib/katello/lazy_accessor.rb +1 -1
  48. data/app/lib/katello/resources/candlepin.rb +2 -2
  49. data/app/lib/katello/util/data.rb +6 -0
  50. data/app/lib/katello/util/support.rb +1 -1
  51. data/app/models/katello/activation_key.rb +25 -7
  52. data/app/models/katello/concerns/host_managed_extensions.rb +60 -17
  53. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +31 -10
  54. data/app/models/katello/content_facet_applicable_rpm.rb +0 -2
  55. data/app/models/katello/content_facet_erratum.rb +0 -2
  56. data/app/models/katello/content_facet_repository.rb +0 -2
  57. data/app/models/katello/content_view.rb +3 -4
  58. data/app/models/katello/content_view_component.rb +1 -3
  59. data/app/models/katello/content_view_docker_filter_rule.rb +0 -2
  60. data/app/models/katello/content_view_environment.rb +2 -4
  61. data/app/models/katello/content_view_erratum_filter_rule.rb +0 -2
  62. data/app/models/katello/content_view_filter.rb +0 -2
  63. data/app/models/katello/content_view_package_filter_rule.rb +0 -2
  64. data/app/models/katello/content_view_package_group_filter_rule.rb +0 -2
  65. data/app/models/katello/content_view_puppet_environment.rb +0 -2
  66. data/app/models/katello/content_view_puppet_environment_puppet_module.rb +0 -2
  67. data/app/models/katello/content_view_puppet_module.rb +0 -2
  68. data/app/models/katello/content_view_repository.rb +0 -2
  69. data/app/models/katello/content_view_version.rb +0 -2
  70. data/app/models/katello/erratum_bugzilla.rb +0 -2
  71. data/app/models/katello/erratum_cve.rb +0 -2
  72. data/app/models/katello/erratum_package.rb +0 -2
  73. data/app/models/katello/ext/label_from_name.rb +1 -1
  74. data/app/models/katello/glue/candlepin/pool.rb +18 -11
  75. data/app/models/katello/glue/candlepin/product.rb +1 -2
  76. data/app/models/katello/glue/pulp/repo.rb +13 -6
  77. data/app/models/katello/glue/pulp/repos.rb +16 -16
  78. data/app/models/katello/gpg_key.rb +0 -2
  79. data/app/models/katello/host/content_facet.rb +21 -0
  80. data/app/models/katello/host/info_provider.rb +56 -0
  81. data/app/models/katello/host/subscription_facet.rb +5 -3
  82. data/app/models/katello/host_collection.rb +0 -2
  83. data/app/models/katello/host_collection_hosts.rb +0 -2
  84. data/app/models/katello/host_installed_package.rb +0 -2
  85. data/app/models/katello/host_tracer.rb +0 -2
  86. data/app/models/katello/key_host_collection.rb +0 -2
  87. data/app/models/katello/kt_environment.rb +0 -2
  88. data/app/models/katello/model.rb +1 -1
  89. data/app/models/katello/pool.rb +3 -3
  90. data/app/models/katello/product.rb +10 -3
  91. data/app/models/katello/provider.rb +0 -2
  92. data/app/models/katello/repository.rb +0 -2
  93. data/app/models/katello/repository_docker_manifest.rb +0 -2
  94. data/app/models/katello/repository_erratum.rb +0 -2
  95. data/app/models/katello/repository_file.rb +0 -2
  96. data/app/models/katello/repository_ostree_branch.rb +0 -2
  97. data/app/models/katello/repository_package_group.rb +0 -1
  98. data/app/models/katello/repository_puppet_module.rb +0 -2
  99. data/app/models/katello/repository_rpm.rb +0 -2
  100. data/app/models/katello/rpm.rb +2 -2
  101. data/app/models/katello/subscription_facet_activation_key.rb +0 -2
  102. data/app/models/katello/subscription_facet_pool.rb +6 -0
  103. data/app/models/katello/subscription_product.rb +0 -1
  104. data/app/models/katello/sync_plan.rb +0 -2
  105. data/app/models/katello/task_status.rb +2 -4
  106. data/app/models/setting/content.rb +2 -0
  107. data/app/services/katello/candlepin/consumer.rb +1 -2
  108. data/app/services/katello/candlepin/message_handler.rb +88 -0
  109. data/app/services/katello/repository_type_manager.rb +1 -1
  110. data/app/views/dashboard/_content_views_widget.html.erb +2 -2
  111. data/app/views/dashboard/_errata_widget.html.erb +3 -3
  112. data/app/views/foreman/smart_proxies/_content_sync.html.erb +25 -8
  113. data/app/views/foreman/unattended/kickstart-katello-atomic.erb +1 -1
  114. data/app/views/foreman/unattended/kickstart-katello.erb +1 -1
  115. data/app/views/katello/api/v2/common/_org_reference.json.rabl +1 -0
  116. data/app/views/katello/api/v2/content_facet/base.json.rabl +3 -14
  117. data/app/views/katello/api/v2/products/base.json.rabl +1 -1
  118. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  119. data/app/views/katello/api/v2/repository_sets/show.json.rabl +8 -1
  120. data/app/views/katello/api/v2/subscriptions/base.json.rabl +0 -7
  121. data/app/views/katello/api/v2/subscriptions/show.json.rabl +4 -37
  122. data/config/routes/overrides.rb +1 -0
  123. data/db/migrate/20140422000001_update_products_add_organization.rb +1 -1
  124. data/db/migrate/20140610154745_content_view_puppet_environment_id.rb +1 -1
  125. data/db/migrate/20140626204657_add_unlimited_to_activation_keys.rb +1 -1
  126. data/db/migrate/20140626204902_add_unlimited_to_host_collection.rb +1 -1
  127. data/db/migrate/20141209103005_disown_foreman_templates.rb +1 -1
  128. data/db/migrate/20150901213759_remove_distributors.rb +1 -1
  129. data/db/migrate/20150908222711_drop_marketing_engineering_products.rb +1 -1
  130. data/db/migrate/20150930183738_migrate_content_hosts.rb +20 -20
  131. data/db/migrate/20151014144004_host_collection_to_hosts.rb +5 -5
  132. data/db/migrate/20160114200145_add_mirror_on_sync_to_repositories.rb +1 -1
  133. data/db/migrate/20160131182301_add_download_policy_to_katello_repositories.rb +1 -1
  134. data/db/migrate/20160222143432_move_system_description_to_host.rb +2 -2
  135. data/db/migrate/20160404132250_remove_katello_from_notification_name.rb +1 -1
  136. data/db/migrate/20160426145517_move_host_description_to_host_comment.rb +1 -1
  137. data/db/migrate/20160617124149_remove_duplicate_view_filters.rb +4 -4
  138. data/db/migrate/20160619223332_fix_viewer_role.rb +4 -4
  139. data/db/migrate/20160701180402_add_sortable_version_to_puppet_modules.rb +1 -1
  140. data/db/migrate/20160924213020_change_katello_widget_names.rb +1 -1
  141. data/db/migrate/20161014133811_move_content_view_version_description_to_histories.rb +2 -2
  142. data/db/migrate/20161026191118_fix_invalid_interfaces.rb +1 -1
  143. data/db/migrate/20170321012632_fill_in_content_view_components.rb +3 -3
  144. data/db/migrate/20170718142148_create_katello_subscription_facet_pools.rb +15 -0
  145. data/db/migrate/20170821170915_add_index_to_installed_packages.rb +5 -0
  146. data/db/migrate/20170821170916_add_nvra_index_to_installed_packages.rb +5 -0
  147. data/db/migrate/20170913183848_add_errata_counts.rb +23 -0
  148. data/db/seeds.d/101-locations.rb +2 -2
  149. data/db/seeds.d/102-organizations.rb +3 -3
  150. data/db/seeds.d/103-provisioning_templates.rb +29 -31
  151. data/db/seeds.d/104-proxy.rb +10 -12
  152. data/db/seeds.d/106-mail_notifications.rb +30 -32
  153. data/db/seeds.d/107-enable_dynflow.rb +3 -4
  154. data/db/seeds.d/108-subcription-bookmarks.rb +12 -10
  155. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/activation-keys.routes.js +1 -1
  156. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/views/activation-key-new.html +1 -1
  157. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/architectures/architecture.factory.js +15 -0
  158. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/architectures/architectures.module.js +14 -0
  159. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +1 -0
  160. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
  161. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/capsule-content/capsule-content.controller.js +2 -2
  162. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-repository-sets-modal.controller.js +107 -0
  163. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-repository-sets-modal.html +113 -0
  164. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js +13 -0
  165. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +25 -4
  166. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +4 -4
  167. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +15 -12
  168. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-repository-sets.html +1 -1
  169. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts.html +11 -5
  170. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-activation-keys.html +15 -12
  171. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/deletion/views/version-deletion-content-hosts.html +16 -12
  172. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/apply-errata.controller.js +9 -6
  173. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata-counts.html +6 -12
  174. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/views/errata.html +4 -1
  175. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-bulk-action.factory.js +1 -0
  176. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/views/packages.html +5 -2
  177. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/repository-details-info.controller.js +20 -2
  178. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-info.html +9 -1
  179. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +22 -3
  180. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +17 -1
  181. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.controller.js +1 -1
  182. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.module.js +1 -0
  183. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repository-sets/repository-set.factory.js +16 -0
  184. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-details.controller.js +4 -0
  185. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-details.html +0 -19
  186. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-info.html +31 -0
  187. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/subscriptions.routes.js +1 -1
  188. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/tasks/views/tasks-table.html +6 -3
  189. data/lib/katello/permissions/host_permissions.rb +1 -0
  190. data/lib/katello/plugin.rb +7 -5
  191. data/lib/katello/tasks/clean_installed_packages.rake +54 -0
  192. data/lib/katello/tasks/import_subscriptions.rake +8 -0
  193. data/lib/katello/tasks/{setup.rake → reset.rake} +10 -0
  194. data/lib/katello/tasks/test.rake +18 -0
  195. data/lib/katello/version.rb +1 -1
  196. data/vendor/assets/stylesheets/katello/{jquery-ui-1.8.11.custom.css → jquery-ui-1.8.11.custom.css.scss} +0 -0
  197. data/vendor/assets/stylesheets/katello/{jquery.loadmask.css → jquery.loadmask.css.scss} +0 -0
  198. data/vendor/assets/stylesheets/katello/{jquery.treeTable.scss → jquery.treeTable.css.scss} +0 -0
  199. data/vendor/assets/stylesheets/katello/{ui.spinner.css → ui.spinner.css.scss} +0 -0
  200. metadata +43 -21
  201. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-activation-keys.controller.js +0 -30
  202. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-content-hosts.controller.js +0 -45
  203. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-activation-keys.html +0 -48
  204. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-content-hosts.html +0 -62
  205. data/lib/katello/tasks/upgrades/2.4/import_subscriptions.rake +0 -12
  206. data/lib/katello/tasks/upgrades/3.3/import_subscriptions.rake +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6decdc9453fd01ddb91c38c97e6404c2f34cc783
4
- data.tar.gz: 73716c2989e80487d5adbe8cf9cf638296ab924f
3
+ metadata.gz: 197daf28e10fa953b9af390cfb2032282e21cc3c
4
+ data.tar.gz: ab856dbc2c77fb57a3275adec5059d63c25432ba
5
5
  SHA512:
6
- metadata.gz: 7b47b7ced813970a5a2b46d993c076f10e4ea82be0952b9f39be28f1146f3b1b3f7c3088ee611451374a3f3f2f84b8267a42c2d01596111c89e715afdb569187
7
- data.tar.gz: 01775bd60e7f80c929ad14c2328482d9ecd38f30224b0411c9b3f425a7d9b81ea41529105a9a644da68d212d3d7b3fe807c29bbf788f6b1ffa9e414ebd5505c3
6
+ metadata.gz: e0f7b7e00932a884f30e7b4239322c994ad12fc952fa78a4d437bc9e005824de3c472d515bf9cb8a6d2af88c3fd40fdea5a8766ae25658b0ca5096f58664f999
7
+ data.tar.gz: d5bf3847cb11fd990a81e52d8fbde811322671d5498a8d547ac1ab4d2fff47ec11d75417befcd9972b27004056853d6fd26a0bb592a50521f8a0e19e922c4d83
data/README.md CHANGED
@@ -67,6 +67,10 @@ That's rather unfortunate. But don't worry! We can help. Just file a bug
67
67
 
68
68
  See the [developer documentation](http://www.katello.org/developers/index.html).
69
69
 
70
+ ## Annotated Pulp and Candlepin Workflows and test Scenarios
71
+
72
+ See the [annotation docs](./test/scenarios/README.md) for more information.
73
+
70
74
  ## Contact & Resources
71
75
 
72
76
  * [Katello.org](http://katello.org)
@@ -1,3 +1,10 @@
1
+ /**
2
+ * = require "katello/jquery.loadmask.css"
3
+ * = require "katello/jquery-ui-1.8.11.custom.css"
4
+ * = require "katello/jquery.treeTable.css"
5
+ * = require "katello/ui.spinner.css"
6
+ */
7
+
1
8
  @import "katello/overrides";
2
9
  @import "katello/katello_base";
3
10
  @import "katello/look";
@@ -7,11 +14,6 @@
7
14
  @import "katello/widgets/tabs";
8
15
  @import "katello/katello_sprites";
9
16
 
10
- @import "katello/jquery.loadmask";
11
- @import "katello/jquery-ui-1.8.11.custom";
12
- @import "katello/jquery.treeTable";
13
- @import "katello/ui.spinner";
14
-
15
17
  @import "katello/contents";
16
18
  @import "katello/generic";
17
19
  @import "katello/notifications";
@@ -97,8 +97,8 @@ module Katello
97
97
  @activation_key.content_overrides.each do |content|
98
98
  @new_activation_key.set_content_override(content['contentLabel'], content[:name], content[:value])
99
99
  end
100
- @activation_key.subscriptions.each do |subscription|
101
- @new_activation_key.subscribe(subscription[:id])
100
+ @activation_key.pools.each do |pool|
101
+ @new_activation_key.subscribe(pool[:id])
102
102
  end
103
103
  respond_for_show(:resource => @new_activation_key)
104
104
  end
@@ -228,7 +228,7 @@ module Katello
228
228
  end
229
229
 
230
230
  content_override_values = content_overrides.map do |override_params|
231
- validate_content_overrides_enabled(override_params, @activation_key)
231
+ validate_content_overrides_enabled(override_params)
232
232
  end
233
233
  @activation_key.set_content_overrides(content_override_values)
234
234
  respond_for_show(:resource => @activation_key)
@@ -48,7 +48,9 @@ module Katello
48
48
  search_options[0].blank?
49
49
  end
50
50
 
51
+ # rubocop:disable Metrics/CyclomaticComplexity
51
52
  # rubocop:disable Metrics/MethodLength
53
+ # rubocop:disable Metrics/AbcSize
52
54
  # rubocop:disable Metrics/PerceivedComplexity
53
55
  def scoped_search(query, default_sort_by, default_sort_order, options = {})
54
56
  resource = options[:resource_class] || resource_class
@@ -65,12 +67,18 @@ module Katello
65
67
  query = query.select(group).group(group) if group
66
68
  sub_total = total.zero? ? 0 : scoped_search_total(query, group)
67
69
 
70
+ if params[:order]
71
+ (params[:sort_by], params[:sort_order]) = params[:order].split(' ')
72
+ end
73
+
68
74
  sort_attr = params[:sort_by] || default_sort_by
69
75
 
70
76
  if sort_attr
71
77
  sort_order = (params[:sort_order] || default_sort_order).to_s.downcase
72
78
  sort_order = default_sort_order unless ['desc', 'asc'].include?(sort_order)
73
79
  query = query.order(sort_attr => sort_order.to_sym)
80
+ params[:sort_by] = sort_attr
81
+ params[:sort_order] = sort_order
74
82
  elsif options[:custom_sort]
75
83
  query = options[:custom_sort].call(query)
76
84
  end
@@ -49,9 +49,14 @@ module Katello
49
49
  api :POST, '/capsules/:id/content/sync', N_('Synchronize the content to the smart proxy')
50
50
  param :id, Integer, :desc => N_('Id of the smart proxy'), :required => true
51
51
  param :environment_id, Integer, :desc => N_('Id of the environment to limit the synchronization on')
52
+ param :skip_metadata_check, :bool, :desc => N_('Skip metadata check on each repository on the smart proxy')
52
53
  def sync
53
54
  find_environment if params[:environment_id]
54
- task = async_task(::Actions::Katello::CapsuleContent::Sync, capsule_content.capsule, :environment_id => @environment.try(:id))
55
+ skip_metadata_check = ::Foreman::Cast.to_bool(params[:skip_metadata_check])
56
+ task = async_task(::Actions::Katello::CapsuleContent::Sync,
57
+ capsule_content.capsule,
58
+ :environment_id => @environment.try(:id),
59
+ :skip_metadata_check => skip_metadata_check)
55
60
  respond_for_async :resource => task
56
61
  end
57
62
 
@@ -23,7 +23,7 @@ module Katello
23
23
  param :name, [String, Array], :desc => N_("package, package group, or docker tag names")
24
24
  param :uuid, String, :desc => N_("package group: uuid")
25
25
  param :version, String, :desc => N_("package: version")
26
- param :arch, String, :desc => N_("package: architecture")
26
+ param :architecture, String, :desc => N_("package: architecture")
27
27
  param :min_version, String, :desc => N_("package: minimum version")
28
28
  param :max_version, String, :desc => N_("package: maximum version")
29
29
  param :errata_id, String, :desc => N_("erratum: id")
@@ -68,6 +68,7 @@ module Katello
68
68
  param :id, :identifier, :desc => N_("rule identifier"), :required => true
69
69
  param :name, String, :desc => N_("package, package group, or docker tag: name")
70
70
  param :version, String, :desc => N_("package: version")
71
+ param :architecture, String, :desc => N_("package: architecture")
71
72
  param :min_version, String, :desc => N_("package: minimum version")
72
73
  param :max_version, String, :desc => N_("package: maximum version")
73
74
  param :errata_id, String, :desc => N_("erratum: id")
@@ -76,7 +76,7 @@ module Katello
76
76
  param :iso_mb_size, :number, :desc => N_("maximum size of each ISO in MB"), :required => false
77
77
  param :since, Date, :desc => N_("Optional date of last export (ex: 2010-01-01T12:00:00Z)"), :required => false
78
78
  def export
79
- if !params[:export_to_iso].present? && params[:iso_mb_size].present?
79
+ if params[:export_to_iso].blank? && params[:iso_mb_size].present?
80
80
  fail HttpErrors::BadRequest, _("ISO export must be enabled when specifying ISO size")
81
81
  end
82
82
 
@@ -40,7 +40,7 @@ module Katello
40
40
  content_views = ContentView.readable
41
41
  content_views = content_views.where(:organization_id => @organization.id) if @organization
42
42
  content_views = content_views.in_environment(@environment) if @environment
43
- content_views = content_views.non_default if params[:nondefault]
43
+ content_views = ::Foreman::Cast.to_bool(params[:nondefault]) ? content_views.non_default : content_views.default if params[:nondefault]
44
44
  content_views = ::Foreman::Cast.to_bool(params[:noncomposite]) ? content_views.non_composite : content_views.composite if params[:noncomposite]
45
45
  content_views = ::Foreman::Cast.to_bool(params[:composite]) ? content_views.composite : content_views.non_composite if params[:composite]
46
46
  content_views = content_views.where(:name => params[:name]) if params[:name]
@@ -27,7 +27,7 @@ module Katello
27
27
  api :GET, "/organizations/:organization_id/host_collections", N_("List host collections within an organization")
28
28
  api :GET, "/activation_keys/:activation_key_id/host_collections", N_("List host collections in an activation key")
29
29
  param_group :search, Api::V2::ApiController
30
- param :organization_id, :number, :desc => N_("organization identifier"), :required => false
30
+ param :organization_id, :number, :desc => N_("organization identifier"), :required => true
31
31
  param :name, String, :desc => N_("host collection name to filter by")
32
32
  param :activation_key_id, :identifier, :desc => N_("activation key identifier")
33
33
  param :host_id, :identifier, :desc => N_("Filter products by host id")
@@ -159,7 +159,7 @@ module Katello
159
159
  end
160
160
 
161
161
  content_override_values = content_overrides.map do |override_params|
162
- validate_content_overrides_enabled(override_params, @host)
162
+ validate_content_overrides_enabled(override_params)
163
163
  end
164
164
  sync_task(::Actions::Katello::Host::UpdateContentOverrides, @host, content_override_values, false)
165
165
  product_content
@@ -195,7 +195,7 @@ module Katello
195
195
  end
196
196
 
197
197
  def check_subscriptions
198
- fail HttpErrors::BadRequest, _("subscriptions not specified") if params[:subscriptions].nil? || params[:subscriptions].empty?
198
+ fail HttpErrors::BadRequest, _("subscriptions not specified") if params[:subscriptions].blank?
199
199
  end
200
200
 
201
201
  def find_host
@@ -12,7 +12,7 @@ module Katello
12
12
  api :GET, "/hosts/:host_id/tracer", N_("List servises that need restarting on the host")
13
13
  param :host_id, :identifier, :required => true, :desc => N_("ID of the host")
14
14
  def index
15
- collection = scoped_search(index_relation.uniq, :application, :asc, :resource_class => ::Katello::HostTracer)
15
+ collection = scoped_search(index_relation, :application, :asc, :resource_class => ::Katello::HostTracer)
16
16
  respond_for_index(:collection => collection)
17
17
  end
18
18
 
@@ -6,9 +6,9 @@ module Katello
6
6
  before_action :find_host_collections, :only => [:bulk_add_host_collections, :bulk_remove_host_collections]
7
7
  before_action :find_environment, :only => [:environment_content_view]
8
8
  before_action :find_content_view, :only => [:environment_content_view]
9
- before_action :find_editable_hosts, :except => [:destroy_hosts, :applicable_errata]
9
+ before_action :find_editable_hosts, :except => [:destroy_hosts, :installable_errata]
10
10
  before_action :find_deletable_hosts, :only => [:destroy_hosts]
11
- before_action :find_readable_hosts, :only => [:applicable_errata, :available_incremental_updates]
11
+ before_action :find_readable_hosts, :only => [:installable_errata, :available_incremental_updates]
12
12
  before_action :find_errata, :only => [:available_incremental_updates]
13
13
 
14
14
  before_action :validate_content_action, :only => [:install_content, :update_content, :remove_content]
@@ -91,8 +91,8 @@ module Katello
91
91
  :resource => { 'displayMessages' => display_messages }
92
92
  end
93
93
 
94
- api :POST, "/hosts/bulk/applicable_errata",
95
- N_("Fetch applicable errata for a host.")
94
+ api :POST, "/hosts/bulk/installable_errata",
95
+ N_("Fetch installable errata for a host.")
96
96
  param_group :bulk_params
97
97
  def installable_errata
98
98
  respond_for_index(:collection => scoped_search(Katello::Erratum.installable_for_hosts(@hosts), 'updated', 'desc',
@@ -176,7 +176,7 @@ module Katello
176
176
  respond_for_async :resource => task
177
177
  end
178
178
 
179
- api :PUT, "/hosts/bulk/subscriptions/content_overrides", N_("Set content overrides to one or more hosts")
179
+ api :PUT, "/hosts/bulk/content_overrides", N_("Set content overrides to one or more hosts")
180
180
  param_group :bulk_params
181
181
  param :content_overrides, Array, :desc => N_("Array of Content override parameters") do
182
182
  param :content_label, String, :desc => N_("Label of the content"), :required => true
@@ -190,7 +190,7 @@ module Katello
190
190
  validate_content_overrides_enabled(content_override_params)
191
191
  end
192
192
 
193
- task = async_task(::Actions::BulkAction, ::Actions::Katello::Host::UpdateContentOverrides, @hosts, content_override_values)
193
+ task = async_task(::Actions::BulkAction, ::Actions::Katello::Host::UpdateContentOverrides, @hosts, content_override_values, false)
194
194
  respond_for_async :resource => task
195
195
  end
196
196
 
@@ -143,11 +143,11 @@ module Katello
143
143
  gpg_key = @gpg_key
144
144
  end
145
145
  repo_params[:label] = labelize_params(repo_params)
146
+ repo_params[:arch] = repo_params[:arch] || 'noarch'
146
147
  repo_params[:url] = nil if repo_params[:url].blank?
147
- unprotected = repo_params.key?(:unprotected) ? repo_params[:unprotected] : true
148
- repository = @product.add_repo(repo_params[:label], repo_params[:name], repo_params[:url],
149
- repo_params[:content_type], unprotected,
150
- gpg_key, repository_params[:checksum_type], repo_params[:download_policy])
148
+ repo_params[:unprotected] = repo_params.key?(:unprotected) ? repo_params[:unprotected] : true
149
+ repo_params[:gpg_key] = gpg_key
150
+ repository = @product.add_repo(Hash[repo_params.slice(:label, :name, :url, :content_type, :arch, :unprotected, :gpg_key, :checksum_type, :download_policy).map { |k, v| [k.to_sym, v] }])
151
151
  repository.docker_upstream_name = repo_params[:docker_upstream_name] if repo_params[:docker_upstream_name]
152
152
  repository.mirror_on_sync = ::Foreman::Cast.to_bool(repo_params[:mirror_on_sync]) if repo_params.key?(:mirror_on_sync)
153
153
  repository.verify_ssl_on_sync = ::Foreman::Cast.to_bool(repo_params[:verify_ssl_on_sync]) if repo_params.key?(:verify_ssl_on_sync)
@@ -217,7 +217,7 @@ module Katello
217
217
  param :iso_mb_size, :number, :desc => N_("maximum size of each ISO in MB"), :required => false
218
218
  param :since, Date, :desc => N_("Optional date of last export (ex: 2010-01-01T12:00:00Z)"), :required => false
219
219
  def export
220
- if !params[:export_to_iso].present? && params[:iso_mb_size].present?
220
+ if params[:export_to_iso].blank? && params[:iso_mb_size].present?
221
221
  fail HttpErrors::BadRequest, _("ISO export must be enabled when specifying ISO size")
222
222
  end
223
223
 
@@ -325,7 +325,6 @@ module Katello
325
325
  else
326
326
  fail HttpErrors::BadRequest, _("No file uploaded")
327
327
  end
328
-
329
328
  rescue Katello::Errors::InvalidRepositoryContent => error
330
329
  respond_for_exception(
331
330
  error,
@@ -418,7 +417,7 @@ module Katello
418
417
  end
419
418
 
420
419
  def repository_params
421
- keys = [:download_policy, :mirror_on_sync, :verify_ssl_on_sync, :upstream_password, :upstream_username,
420
+ keys = [:download_policy, :mirror_on_sync, :arch, :verify_ssl_on_sync, :upstream_password, :upstream_username,
422
421
  :ostree_upstream_sync_depth, :ostree_upstream_sync_policy
423
422
  ]
424
423
  keys += [:label, :content_type] if params[:action] == "create"
@@ -2,7 +2,8 @@ module Katello
2
2
  class Api::V2::RepositorySetsController < Api::V2::ApiController
3
3
  respond_to :json
4
4
 
5
- before_action :find_product
5
+ before_action :find_product, :except => [:index]
6
+ before_action :find_optional_product, :only => [:index]
6
7
  before_action :custom_product?
7
8
  before_action :find_product_content, :except => [:index]
8
9
 
@@ -16,7 +17,11 @@ module Katello
16
17
  param_group :search, Api::V2::ApiController
17
18
  def index
18
19
  collection = {}
19
- collection[:results] = @product.displayable_product_contents
20
+ if @product.nil?
21
+ collection[:results] = available_repository_sets
22
+ else
23
+ collection[:results] = @product.displayable_product_contents
24
+ end
20
25
  # filter on name if it is provided
21
26
  collection[:results] = collection[:results].select { |pc| pc.content.name == params[:name] } if params[:name]
22
27
  collection[:subtotal] = collection[:results].size
@@ -83,18 +88,34 @@ module Katello
83
88
  fail HttpErrors::NotFound, _("Couldn't find repository set with id '%s'.") % params[:id] if @product_content.nil?
84
89
  end
85
90
 
86
- def find_product
91
+ def find_optional_product
87
92
  @product = Product.find_by(:id => params[:product_id])
93
+ @organization = @product.organization unless @product.nil?
94
+ find_organization if @organization.nil?
95
+ @product
96
+ end
97
+
98
+ def find_product
99
+ @product = find_optional_product
88
100
  fail HttpErrors::NotFound, _("Couldn't find product with id '%s'") % params[:product_id] if @product.nil?
89
101
  @organization = @product.organization
90
102
  end
91
103
 
92
104
  def custom_product?
93
- fail _('Repository sets are not available for custom products.') if @product.custom?
105
+ fail _('Repository sets are not available for custom products.') if @product && @product.custom?
94
106
  end
95
107
 
96
108
  def substitutions
97
109
  params.slice(:basearch, :releasever)
98
110
  end
111
+
112
+ def available_repository_sets
113
+ repository_sets = @organization.products.enabled.uniq.flat_map do |product|
114
+ product.available_content
115
+ end
116
+ repository_sets.uniq.sort_by do |repository_set|
117
+ repository_set.content.name.downcase
118
+ end
119
+ end
99
120
  end
100
121
  end
@@ -3,8 +3,7 @@ module Katello
3
3
  module Api::V2::ContentOverridesController
4
4
  extend ActiveSupport::Concern
5
5
 
6
- # overriden_object => pass it either an activation key or content host
7
- def validate_content_overrides_enabled(content_params, overriden_object = nil)
6
+ def validate_content_overrides_enabled(content_params)
8
7
  name = content_params[:name] || "enabled"
9
8
  compare_value = content_params[:value].to_s.downcase
10
9
  remove = content_params.key?(:remove) ? ::Foreman::Cast.to_bool(content_params[:remove]) : nil
@@ -16,8 +15,7 @@ module Katello
16
15
  fail HttpErrors::BadRequest, _("Value must either be a boolean or 'default' for 'enabled'")
17
16
  end
18
17
 
19
- if content_label.blank? || (overriden_object &&
20
- !overriden_object.valid_content_override_label?(content_label))
18
+ if content_label.blank?
21
19
  fail HttpErrors::BadRequest, _("Invalid content label: %s") % content_params[:content_label]
22
20
  end
23
21
 
@@ -1,50 +1,33 @@
1
1
  module Katello
2
2
  module Concerns
3
3
  module Api::V2::HostgroupsControllerExtensions
4
- extend ActiveSupport::Concern
4
+ module ApiPieExtensions
5
+ extend ::Apipie::DSL::Concern
5
6
 
6
- included do
7
- def_param_group :hostgroup do
8
- param :hostgroup, Hash, :required => true, :action_aware => true do
9
- param :name, String, :required => true, :desc => N_('Name of the host group')
10
- param :parent_id, :number, :desc => N_('Parent ID of the host group')
11
- param :environment_id, :number, :desc => N_('Environment ID')
12
- param :compute_profile_id, :number, :desc => N_('Compute profile ID')
13
- param :operatingsystem_id, :number, :desc => N_('Operating system ID')
14
- param :architecture_id, :number, :desc => N_('Architecture ID')
15
- param :pxe_loader, Operatingsystem.all_loaders, :desc => N_("DHCP filename option (Grub2/PXELinux by default)")
16
- param :medium_id, :number, :desc => N_('Media ID')
17
- param :ptable_id, :number, :desc => N_('Partition table ID')
18
- param :puppet_ca_proxy_id, :number, :desc => N_('Puppet CA proxy ID')
19
- param :subnet_id, :number, :desc => N_('Subnet ID')
20
- param :domain_id, :number, :desc => N_('Domain ID')
21
- param :realm_id, :number, :desc => N_('Realm ID')
22
- param :puppet_proxy_id, :number, :desc => N_('Puppet proxy ID')
23
- param :root_pass, String, :desc => N_('Root password on provisioned hosts')
7
+ update_api(:create, :update) do
8
+ param :hostgroup, Hash do
24
9
  param :content_source_id, :number, :desc => N_('Content source ID')
25
10
  param :content_view_id, :number, :desc => N_('Content view ID')
26
11
  param :lifecycle_environment_id, :number, :desc => N_('Lifecycle environment ID')
27
12
  param :kickstart_repository_id, :number, :desc => N_('Kickstart repository ID')
28
- param_group :taxonomies, ::Api::V2::BaseController
29
13
  end
30
14
  end
15
+ end
16
+
17
+ extend ActiveSupport::Concern
18
+
19
+ included do
20
+ include ApiPieExtensions
31
21
 
32
- api :POST, "/hostgroups/", N_("Create a host group")
33
- param_group :hostgroup, :as => :create
34
22
  def create
35
23
  @hostgroup = Hostgroup.new(hostgroup_params)
36
24
  process_response @hostgroup.save
37
25
  end
38
26
 
39
- api :PUT, "/hostgroups/:id/", N_("Update a host group")
40
- param :id, :identifier, :required => true
41
- param_group :hostgroup
42
27
  def update
43
28
  process_response @hostgroup.update_attributes(hostgroup_params)
44
29
  end
45
30
 
46
- api :GET, "/hostgroups/:id", N_("Show a host group")
47
- param :id, :identifier, :required => true
48
31
  def show
49
32
  @render_template = 'katello/api/v2/hostgroups_extensions/show'
50
33
  render @render_template
@@ -1,31 +1,27 @@
1
1
  module Katello
2
2
  module Concerns
3
3
  module Api::V2::SmartProxiesControllerExtensions
4
- extend ActiveSupport::Concern
4
+ module ApiPieExtensions
5
+ extend ::Apipie::DSL::Concern
5
6
 
6
- included do
7
- def_param_group :smart_proxy do
8
- param :smart_proxy, Hash, :required => true, :action_aware => true do
9
- param :name, String, :required => true
10
- param :url, String, :required => true
7
+ update_api(:create, :update) do
8
+ param :smart_proxy, Hash do
11
9
  param :download_policy, String, :required => false, :desc => N_('Download Policy of the capsule, must be one of %s') %
12
- SmartProxy::DOWNLOAD_POLICIES.join(', ')
13
- param_group :taxonomies, ::Api::V2::BaseController
10
+ SmartProxy::DOWNLOAD_POLICIES.join(', ')
14
11
  end
15
12
  end
13
+ end
16
14
 
17
- api :POST, "/smart_proxies/", N_("Create a smart proxy")
18
- param_group :smart_proxy, :as => :create
15
+ extend ActiveSupport::Concern
16
+
17
+ included do
18
+ include ApiPieExtensions
19
19
 
20
20
  def create
21
21
  @smart_proxy = SmartProxy.new(smart_proxy_params)
22
22
  process_response @smart_proxy.save
23
23
  end
24
24
 
25
- api :PUT, "/smart_proxies/:id/", N_("Update a smart proxy")
26
- param :id, String, :required => true
27
- param_group :smart_proxy
28
-
29
25
  def update
30
26
  process_response @smart_proxy.update_attributes(smart_proxy_params)
31
27
  end