katello 3.0.2 → 3.1.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 (215) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/sync_management/sync_management.js +14 -5
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +4 -4
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +2 -0
  5. data/app/controllers/katello/api/v2/api_controller.rb +1 -1
  6. data/app/controllers/katello/api/v2/content_uploads_controller.rb +1 -1
  7. data/app/controllers/katello/api/v2/content_view_puppet_modules_controller.rb +2 -12
  8. data/app/controllers/katello/api/v2/content_view_versions_controller.rb +4 -4
  9. data/app/controllers/katello/api/v2/content_views_controller.rb +2 -4
  10. data/app/controllers/katello/api/v2/environments_controller.rb +0 -16
  11. data/app/controllers/katello/api/v2/host_contents_controller.rb +9 -0
  12. data/app/controllers/katello/api/v2/host_errata_controller.rb +1 -1
  13. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -1
  14. data/app/controllers/katello/api/v2/host_subscriptions_controller.rb +25 -6
  15. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +3 -2
  16. data/app/controllers/katello/api/v2/repositories_controller.rb +6 -3
  17. data/app/controllers/katello/api/v2/sync_plans_controller.rb +2 -1
  18. data/app/controllers/katello/api/v2/systems_controller.rb +1 -13
  19. data/app/controllers/katello/application_controller.rb +15 -18
  20. data/app/controllers/katello/concerns/api/v2/hosts_controller_extensions.rb +11 -7
  21. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +1 -1
  22. data/app/controllers/katello/concerns/authorization/api/v2/content_views_controller.rb +1 -1
  23. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +1 -1
  24. data/app/controllers/katello/concerns/smart_proxies_controller_extensions.rb +2 -2
  25. data/app/helpers/katello/application_helper.rb +1 -1
  26. data/app/helpers/katello/concerns/settings_helper_extensions.rb +3 -2
  27. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +1 -1
  28. data/app/helpers/katello/katello_form_builder.rb +1 -1
  29. data/app/helpers/katello/katello_url_helper.rb +2 -2
  30. data/app/lib/actions/candlepin/candlepin_listening_service.rb +3 -3
  31. data/app/lib/actions/candlepin/consumer/remove_subscription.rb +6 -0
  32. data/app/lib/actions/candlepin/import_pool_handler.rb +2 -1
  33. data/app/lib/actions/katello/capsule_content/create_repos.rb +1 -1
  34. data/app/lib/actions/katello/capsule_content/sync.rb +4 -5
  35. data/app/lib/actions/katello/content_view/errata_mail.rb +1 -1
  36. data/app/lib/actions/katello/content_view/presenters/incremental_updates_presenter.rb +1 -1
  37. data/app/lib/actions/katello/content_view/promote.rb +8 -3
  38. data/app/lib/actions/katello/content_view/publish.rb +8 -3
  39. data/app/lib/actions/katello/content_view/remove.rb +2 -2
  40. data/app/lib/actions/katello/content_view_version/incremental_update.rb +1 -1
  41. data/app/lib/actions/katello/host/erratum/applicable_errata_install.rb +1 -1
  42. data/app/lib/actions/katello/host/generate_applicability.rb +1 -1
  43. data/app/lib/actions/katello/host/hypervisors_update.rb +23 -5
  44. data/app/lib/actions/katello/host/register.rb +2 -11
  45. data/app/lib/actions/katello/host/remove_subscriptions.rb +1 -1
  46. data/app/lib/actions/katello/host/update.rb +1 -1
  47. data/app/lib/actions/katello/host/update_content_view.rb +5 -1
  48. data/app/lib/actions/katello/repository/errata_mail.rb +1 -1
  49. data/app/lib/actions/katello/repository/export.rb +1 -1
  50. data/app/lib/actions/katello/repository/sync.rb +2 -0
  51. data/app/lib/actions/pulp/abstract_async_task.rb +1 -1
  52. data/app/lib/actions/pulp/abstract_async_task_group.rb +76 -0
  53. data/app/lib/actions/pulp/consumer/create.rb +1 -1
  54. data/app/lib/actions/pulp/repos/update.rb +2 -1
  55. data/app/lib/actions/pulp/repository/associate_importer.rb +4 -0
  56. data/app/lib/actions/pulp/repository/import_upload.rb +0 -4
  57. data/app/lib/actions/pulp/repository/refresh.rb +7 -18
  58. data/app/lib/actions/pulp/repository/regenerate_applicability.rb +2 -2
  59. data/app/lib/actions/pulp/repository/sync.rb +1 -1
  60. data/app/lib/actions/pulp/repository/update_importer.rb +4 -0
  61. data/app/lib/katello/api/v2/error_handling.rb +1 -1
  62. data/app/lib/katello/bulk_actions.rb +7 -8
  63. data/app/lib/katello/capsule_content.rb +11 -11
  64. data/app/lib/katello/errors.rb +2 -0
  65. data/app/lib/katello/glue/queue.rb +1 -1
  66. data/app/lib/katello/resources/candlepin.rb +3 -3
  67. data/app/lib/katello/resources/cdn.rb +1 -1
  68. data/app/lib/katello/util/cdn_var_substitutor.rb +1 -1
  69. data/app/lib/katello/util/package.rb +1 -1
  70. data/app/lib/katello/util/package_filter.rb +4 -4
  71. data/app/lib/katello/util/search.rb +3 -3
  72. data/app/lib/katello/validators/content_view_puppet_module_validator.rb +20 -14
  73. data/app/models/katello/activation_key.rb +4 -4
  74. data/app/models/katello/concerns/content_facet_host_extensions.rb +2 -2
  75. data/app/models/katello/concerns/host_managed_extensions.rb +6 -2
  76. data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -2
  77. data/app/models/katello/concerns/organization_extensions.rb +5 -1
  78. data/app/models/katello/concerns/smart_proxy_extensions.rb +2 -13
  79. data/app/models/katello/concerns/subscription_facet_host_extensions.rb +27 -2
  80. data/app/models/katello/content_view.rb +5 -5
  81. data/app/models/katello/content_view_erratum_filter_rule.rb +3 -3
  82. data/app/models/katello/content_view_filter.rb +3 -3
  83. data/app/models/katello/content_view_history.rb +4 -4
  84. data/app/models/katello/content_view_repository.rb +1 -1
  85. data/app/models/katello/erratum.rb +14 -10
  86. data/app/models/katello/glue.rb +0 -2
  87. data/app/models/katello/glue/candlepin/consumer.rb +4 -4
  88. data/app/models/katello/glue/candlepin/content.rb +2 -2
  89. data/app/models/katello/glue/candlepin/pool.rb +6 -0
  90. data/app/models/katello/glue/candlepin/product.rb +1 -1
  91. data/app/models/katello/glue/provider.rb +1 -1
  92. data/app/models/katello/glue/pulp/consumer.rb +3 -3
  93. data/app/models/katello/glue/pulp/repo.rb +26 -31
  94. data/app/models/katello/glue/pulp/repos.rb +1 -1
  95. data/app/models/katello/host/content_facet.rb +6 -1
  96. data/app/models/katello/host/subscription_facet.rb +1 -8
  97. data/app/models/katello/host_collection.rb +1 -82
  98. data/app/models/katello/hypervisor.rb +1 -1
  99. data/app/models/katello/kt_environment.rb +3 -2
  100. data/app/models/katello/package_group.rb +2 -2
  101. data/app/models/katello/ping.rb +4 -4
  102. data/app/models/katello/provider.rb +8 -1
  103. data/app/models/katello/pulp_sync_status.rb +7 -7
  104. data/app/models/katello/pulp_task_status.rb +1 -1
  105. data/app/models/katello/repository.rb +6 -6
  106. data/app/models/katello/rhsm_fact_parser.rb +0 -9
  107. data/app/models/katello/sync_plan.rb +14 -21
  108. data/app/models/katello/system.rb +6 -12
  109. data/app/models/katello/task_status.rb +3 -24
  110. data/app/models/setting/{katello.rb → content.rb} +10 -2
  111. data/app/overrides/add_about_page.rb +3 -3
  112. data/app/overrides/add_organization_attributes.rb +2 -2
  113. data/app/overrides/add_subscription_status.rb +1 -1
  114. data/app/services/katello/candlepin/consumer.rb +8 -8
  115. data/app/services/katello/pulp/consumer.rb +1 -1
  116. data/app/services/katello/pulp/consumer_group.rb +3 -3
  117. data/app/services/katello/pulp/docker_manifest.rb +1 -1
  118. data/app/services/katello/pulp/erratum.rb +1 -1
  119. data/app/services/katello/pulp/ostree_branch.rb +1 -1
  120. data/app/services/katello/pulp/package_group.rb +1 -1
  121. data/app/services/katello/pulp/puppet_module.rb +1 -1
  122. data/app/services/katello/pulp/rpm.rb +3 -3
  123. data/app/services/katello/puppet_class_importer_extensions.rb +1 -1
  124. data/app/views/dashboard/_subscription_status_widget.html.erb +1 -1
  125. data/app/views/foreman/smart_proxies/_content_sync.html.erb +1 -1
  126. data/app/views/foreman/unattended/finish-katello.erb +2 -2
  127. data/app/views/foreman/unattended/kickstart-katello.erb +2 -2
  128. data/app/views/foreman/unattended/userdata-katello.erb +2 -0
  129. data/app/views/katello/api/v2/common/_syncable.json.rabl +1 -1
  130. data/app/views/katello/api/v2/errata/show.json.rabl +2 -2
  131. data/app/views/katello/api/v2/{systems/releases.json.rabl → host_subscriptions/available_release_versions.json.rabl} +0 -0
  132. data/app/views/katello/api/v2/products/base.json.rabl +0 -19
  133. data/app/views/katello/api/v2/products/show.json.rabl +21 -2
  134. data/app/views/katello/api/v2/subscription_facet/base_with_root.json.rabl +2 -1
  135. data/app/views/katello/api/v2/subscriptions/show.json.rabl +19 -17
  136. data/config/katello.yml +242 -0
  137. data/config/routes/api/v2.rb +7 -6
  138. data/config/routes/overrides.rb +10 -5
  139. data/db/migrate/20140117160939_refactor_content_views.rb +4 -4
  140. data/db/migrate/20140318174203_drop_cdn_import_success_column.rb +1 -1
  141. data/db/migrate/20140404122011_drop_repositories_enabled_column.rb +1 -1
  142. data/db/migrate/20140610083129_add_pulp_proxy_to_host.rb +1 -1
  143. data/db/migrate/20140930170628_add_errata.rb +1 -1
  144. data/db/migrate/20141222151001_add_host_content_view_environment.rb +1 -1
  145. data/db/migrate/20150602153756_remove_user_notices.rb +1 -1
  146. data/db/migrate/20150602153757_remove_notices.rb +2 -2
  147. data/db/migrate/20150930183738_migrate_content_hosts.rb +1 -1
  148. data/db/migrate/20160203195736_remove_docker_image_schema.rb +3 -1
  149. data/db/migrate/20160505181337_rename_katello_settings.rb +9 -0
  150. data/db/migrate/20160520175340_add_host_applicable_package.rb +8 -0
  151. data/db/migrate/20160605160933_remove_jobs.rb +25 -0
  152. data/db/migrate/20160605162929_remove_system_smart_proxy.rb +5 -0
  153. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/activation-key-associations.controller.js +14 -5
  154. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-associations-content-hosts.html +8 -8
  155. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-action-packages.controller.js +16 -4
  156. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/bulk-actions-packages.html +27 -2
  157. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js +17 -19
  158. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +1 -2
  159. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +1 -0
  160. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +2 -0
  161. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +3 -3
  162. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details.controller.js +1 -1
  163. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +4 -4
  164. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-provisioning-info.html +1 -1
  165. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-subscriptions.html +2 -2
  166. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts-table-collapsed.html +1 -1
  167. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/views/content-hosts-table-full.html +1 -1
  168. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-details.controller.js +1 -1
  169. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/content-view-versions.controller.js +0 -1
  170. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/gpg-key-details.controller.js +1 -1
  171. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/details/views/gpg-key-details.html +6 -6
  172. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/gpg-keys.controller.js +3 -3
  173. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/gpg-keys.module.js +7 -7
  174. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/new/new-gpg-key.controller.js +1 -1
  175. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/new/views/gpg-key-new.html +2 -2
  176. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/views/gpg-keys.html +1 -1
  177. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/hosts/host-subscription.factory.js +2 -1
  178. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/katello-features.run.js +5 -5
  179. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/check-current-organization.run.js +2 -2
  180. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/organizations/fenced-pages.service.js +2 -1
  181. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-associations-content-hosts.controller.js +1 -1
  182. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-associations-content-hosts.html +1 -1
  183. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js +3 -0
  184. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/views/new-sync-plan-form.html +1 -0
  185. data/engines/bastion_katello/lib/bastion_katello/version.rb +1 -1
  186. data/lib/katello.rb +0 -1
  187. data/lib/katello/engine.rb +12 -8
  188. data/lib/katello/permissions/content_host_permissions.rb +1 -1
  189. data/lib/katello/tasks/clean_backend_objects.rake +5 -6
  190. data/lib/katello/tasks/delete_orphaned_content.rake +1 -1
  191. data/lib/katello/tasks/jenkins.rake +1 -3
  192. data/lib/katello/tasks/jshint.rake +28 -29
  193. data/lib/katello/tasks/jsroutes.rake +2 -2
  194. data/lib/katello/tasks/regenerate_repo_metadata.rake +3 -5
  195. data/lib/katello/tasks/reindex.rake +17 -16
  196. data/lib/katello/tasks/rubocop.rake +1 -3
  197. data/lib/katello/tasks/setup.rake +3 -4
  198. data/lib/katello/tasks/test.rake +8 -23
  199. data/lib/katello/tasks/upgrades/2.4/import_distributions.rake +1 -2
  200. data/lib/katello/tasks/upgrades/2.4/import_package_groups.rake +1 -2
  201. data/lib/katello/tasks/upgrades/2.4/import_puppet_modules.rake +1 -2
  202. data/lib/katello/tasks/upgrades/2.4/import_rpms.rake +1 -1
  203. data/lib/katello/tasks/upgrades/2.4/import_subscriptions.rake +1 -2
  204. data/lib/katello/tasks/upgrades/3.0/add_export_distributor.rake +1 -1
  205. data/lib/katello/tasks/upgrades/3.0/update_subscription_facet_backend_data.rake +1 -1
  206. data/lib/katello/tasks/yard.rake +2 -2
  207. data/lib/katello/version.rb +1 -1
  208. metadata +14 -15
  209. data/app/models/katello/job.rb +0 -197
  210. data/app/models/katello/job_task.rb +0 -10
  211. data/app/views/katello/api/v2/systems_bulk_actions/applicable_errata.json.rabl +0 -7
  212. data/app/views/katello/api/v2/systems_bulk_actions/available_incremental_updates.json.rabl +0 -21
  213. data/app/views/katello/api/v2/systems_bulk_actions/erratum.json.rabl +0 -7
  214. data/app/views/katello/api/v2/systems_bulk_actions/job.json.rabl +0 -1
  215. data/db/migrate/20160619223332_fix_viewer_role.rb +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92f949b0b3a9201bd9163f2fca7c3898feafc2b2
4
- data.tar.gz: 790bcd11ac29bad1d2053314424187189b71afce
3
+ metadata.gz: ae4ab15eb9d39a34a4069ff9b54905840aaf73af
4
+ data.tar.gz: bf8993794d13a72a10086070b705af01bb006be9
5
5
  SHA512:
6
- metadata.gz: cf154c344d10d11683890b9463293f69647f049cfa52dae6c92e33321473cc4b89b55bb3680c1d77a173d3038e6bf19f2258dd2abe6903bf701d12ade2bace6a
7
- data.tar.gz: 04e68a24437d862d0a6fd5632c61669019795f6abb8305b5fe37229004250a91ba2599810d95793b9bceb28c927b60869aae772262ab754b7b4927f3dd8ac527
6
+ metadata.gz: e0c4e3472f5e0c95405197c1f55c17e0b7fa3ea60319b0ce0d8089878616d3f8ba72f3adefc678f17a6ae6289a0a2314c9a1791f3a12d892370fd09958ab7564
7
+ data.tar.gz: 29a7dadc2e1913b3761d182c10fd47937a8d0badb08bd2801e3e80918cb0d57601f59c72f27e90a9dd8e2a7912169a902ba16babf5f5b5cddd8da0f6c4eed13b
@@ -5,7 +5,7 @@ $(document).ready(function() {
5
5
  $.each(KT.repo_status, function(repo_id, status){
6
6
  if (status.is_running) {
7
7
  ids.push(repo_id);
8
- KT.content.draw_syncing(repo_id, status.progress.progress);
8
+ KT.content.draw_syncing(repo_id, status.progress.progress, status.sync_id);
9
9
  }
10
10
  });
11
11
  KT.content.reset_products(KT.repo_status);
@@ -29,7 +29,7 @@ $(document).ready(function() {
29
29
  var ids = [];
30
30
  $.each(data, function(index, item){
31
31
  ids.push(item.id);
32
- KT.content.draw_syncing(item.id, 0);
32
+ KT.content.draw_syncing(item.id, 0, undefined);
33
33
  KT.content.updateProduct(item.product_id, false, 0);
34
34
  });
35
35
  KT.content_actions.addSyncing(ids);
@@ -134,6 +134,7 @@ KT.content_actions = (function(){
134
134
  repo.progress.progress,
135
135
  repo.display_size,
136
136
  repo.packages,
137
+ repo.size,
137
138
  repo.sync_id);
138
139
  }
139
140
  });
@@ -156,11 +157,15 @@ KT.content_actions = (function(){
156
157
 
157
158
  KT.content = (function(){
158
159
 
159
- var draw_syncing = function(repo_id, progress){
160
-
160
+ var draw_syncing = function(repo_id, progress, task_id){
161
161
  var element = $("#repo-" + repo_id).find(".result"),
162
162
  cancelButton = $('<a/>').attr("class", "cancel_sync").text(katelloI18n.cancel),
163
- progressBar = $('<div/>').attr('class', 'progress').text(" ");
163
+ progressBar = $('<a/>').attr('class', 'progress').text(" ");
164
+
165
+ if(task_id !== undefined) {
166
+ progressBar.attr('href', '/foreman_tasks/tasks/' + task_id)
167
+ }
168
+
164
169
  progress = progress ? progress : 0;
165
170
  progressBar.progressbar({
166
171
  value: progress
@@ -200,6 +205,10 @@ KT.content = (function(){
200
205
 
201
206
  starttime = starttime === null ? katelloI18n.no_start_time : starttime;
202
207
 
208
+ if(task_id !== undefined) {
209
+ pg.attr('href', '/foreman_tasks/tasks/' + task_id);
210
+ }
211
+
203
212
  fadeUpdate(element.find(".start_time"), starttime);
204
213
  // clear duration during active sync
205
214
  fadeUpdate(element.find(".duration"), '');
@@ -98,7 +98,7 @@ module Katello
98
98
  organization = find_organization
99
99
  @all_environments = get_content_view_environments(params[:name], organization).collect do |env|
100
100
  {
101
- :id => env.cp_id,
101
+ :id => env.cp_id,
102
102
  :name => env.label,
103
103
  :display_name => env.name,
104
104
  :description => env.content_view.description
@@ -132,7 +132,7 @@ module Katello
132
132
  #param :id, String, :desc => N_("UUID of the consumer"), :required => true
133
133
  def upload_package_profile
134
134
  User.as_anonymous_admin do
135
- async_task(::Actions::Katello::Host::UploadPackageProfile, @host, params[:_json])
135
+ sync_task(::Actions::Katello::Host::UploadPackageProfile, @host, params[:_json])
136
136
  end
137
137
  render :json => Resources::Candlepin::Consumer.get(@host.subscription_facet.uuid)
138
138
  end
@@ -436,8 +436,8 @@ module Katello
436
436
  def authorize_proxy_routes
437
437
  deny_access unless (authenticate || authenticate_client)
438
438
 
439
- route, _, params = Engine.routes.router.recognize(request) do |rte, match, parameters|
440
- break rte, match, parameters if rte.name
439
+ route, params = Engine.routes.router.recognize(request) do |rte, parameters|
440
+ break rte, parameters if rte.name
441
441
  end
442
442
 
443
443
  # route names are defined in routes.rb (:as => :name)
@@ -313,6 +313,8 @@ module Katello
313
313
  :auto_attach,
314
314
  :max_hosts,
315
315
  :unlimited_hosts,
316
+ # For deep_munge; Remove for Rails 5
317
+ :host_collection_ids,
316
318
  :content_overrides => [],
317
319
  :host_collection_ids => [])
318
320
 
@@ -18,7 +18,7 @@ module Katello
18
18
  def_param_group :search do
19
19
  param :search, String, :desc => N_("Search string")
20
20
  param :page, :number, :desc => N_("Page number, starting at 1")
21
- param :per_page, :number, :desc => N_("Number of results per page to return")
21
+ param :per_page, :number, :desc => N_("Number of results per page to return")
22
22
  param :order, String, :desc => N_("Sort field and order, eg. 'name DESC'")
23
23
  param :full_results, :bool, :desc => N_("Whether or not to show all results")
24
24
  param :sort, Hash, :desc => N_("Hash version of 'order' param") do
@@ -3,7 +3,7 @@ module Katello
3
3
  before_filter :find_repository
4
4
  skip_before_filter :check_content_type, :only => [:update]
5
5
 
6
- include Foreman::Controller::FilterParameters
6
+ include ::Foreman::Controller::FilterParameters
7
7
  filter_parameters :content
8
8
 
9
9
  api :POST, "/repositories/:repository_id/content_uploads", N_("Create an upload request")
@@ -3,7 +3,6 @@ module Katello
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
4
 
5
5
  before_filter :find_content_view, :except => [:autocomplete_search]
6
- before_filter :find_puppet_module, :only => [:create]
7
6
  before_filter :find_content_view_puppet_module, :only => [:show, :update, :destroy]
8
7
 
9
8
  api :GET, "/content_views/:content_view_id/content_view_puppet_modules", N_("List content view puppet modules")
@@ -24,13 +23,8 @@ module Katello
24
23
  param :id, String, :desc => N_("the id of the puppet module to associate")
25
24
  param :uuid, String, :desc => N_("the uuid of the puppet module to associate")
26
25
  def create
27
- params[:content_view_puppet_module][:uuid] = @puppet_module.uuid if @puppet_module
28
-
29
- @puppet_module = ContentViewPuppetModule.create!(puppet_module_params) do |puppet_module|
30
- puppet_module.content_view = @view
31
- end
32
-
33
- respond :resource => @puppet_module
26
+ params[:content_view_puppet_module][:uuid] ||= PuppetModule.find(params[:id]).try(:uuid) if params[:id]
27
+ respond resource: ContentViewPuppetModule.create!(puppet_module_params.merge(content_view: @view))
34
28
  end
35
29
 
36
30
  api :GET, "/content_views/:content_view_id/content_view_puppet_modules/:id", N_("Show a content view puppet module")
@@ -79,10 +73,6 @@ module Katello
79
73
  @puppet_module = ContentViewPuppetModule.find(params[:id])
80
74
  end
81
75
 
82
- def find_puppet_module
83
- @puppet_module = PuppetModule.find(params[:id]) if params[:id]
84
- end
85
-
86
76
  def puppet_module_params
87
77
  attrs = [:name, :author, :uuid]
88
78
  params.require(:content_view_puppet_module).permit(*attrs)
@@ -95,7 +95,7 @@ module Katello
95
95
  param :description, String, :desc => N_("The description for the new generated Content View Versions")
96
96
  param :resolve_dependencies, :bool, :desc => N_("If true, when adding the specified errata or packages, any needed dependencies will be copied as well.")
97
97
  param :propagate_all_composites, :bool, :desc => N_("If true, will publish a new composite version using any specified content_view_version_id that has been promoted to a lifecycle environment.")
98
- param :add_content, Hash do
98
+ param :add_content, Hash do
99
99
  param :errata_ids, Array, :desc => "Errata ids or uuids to copy into the new versions."
100
100
  param :package_ids, Array, :desc => "Package ids or uuids to copy into the new versions."
101
101
  param :puppet_module_ids, Array, :desc => "Puppet Module ids or uuids to copy into the new versions."
@@ -127,7 +127,7 @@ module Katello
127
127
 
128
128
  def calculate_hosts_for_incremental(bulk_params, use_composites)
129
129
  if bulk_params[:included].try(:[], :search)
130
- version_environments = find_version_environments_for_hosts(use_composites)
130
+ version_environments = find_version_environments_for_hosts(use_composites)
131
131
  restrict_hosts = lambda do |relation|
132
132
  if version_environments.any?
133
133
  errata = Erratum.with_identifiers(params[:add_content][:errata_ids])
@@ -167,7 +167,7 @@ module Katello
167
167
  list.each do |combination|
168
168
  version_environment = {
169
169
  :content_view_version => ContentViewVersion.find(combination[:content_view_version_id]),
170
- :environments => KTEnvironment.where(:id => combination[:environment_ids])
170
+ :environments => KTEnvironment.where(:id => combination[:environment_ids])
171
171
  }
172
172
 
173
173
  view = version_environment[:content_view_version].content_view
@@ -197,7 +197,7 @@ module Katello
197
197
  component.composites.select { |c| c.environments.any? }.map do |composite|
198
198
  {
199
199
  :content_view_version => composite,
200
- :environments => composite.environments
200
+ :environments => composite.environments
201
201
  }
202
202
  end
203
203
  end
@@ -191,10 +191,8 @@ module Katello
191
191
  def view_params
192
192
  attrs = [:name, :description, {:repository_ids => []}, {:component_ids => []}]
193
193
  attrs.push(:label, :composite) if action_name == "create"
194
- permitted_params = params.require(:content_view).permit(*attrs)
195
- permitted_params[:repository_ids] ||= [] if params[:content_view].key?(:repository_ids)
196
- permitted_params[:component_ids] ||= [] if params[:content_view].key?(:component_ids)
197
- permitted_params
194
+ attrs.push(:component_ids, :repository_ids) # For deep_munge; Remove for Rails 5
195
+ params.require(:content_view).permit(*attrs)
198
196
  end
199
197
 
200
198
  def find_environment
@@ -136,22 +136,6 @@ module Katello
136
136
  respond_for_index(:collection => collection, :template => :paths)
137
137
  end
138
138
 
139
- api :GET, "/organizations/:organization_id/environments/:id/repositories", "List repositories available in the environment"
140
- param :id, :identifier, :desc => "environment identifier"
141
- param :organization_id, String, :desc => "organization identifier"
142
- param :content_view_id, :identifier, :desc => "content view identifier", :required => false
143
- def repositories
144
- if !@environment.library? && @content_view.nil?
145
- fail HttpErrors::BadRequest,
146
- _("Cannot retrieve repos from non-library environment '%s' without a content view.") % @environment.name
147
- end
148
-
149
- @repositories = @environment.products.readable(@organization).flat_map do |p|
150
- p.repos(@environment, @content_view)
151
- end
152
- respond_for_index :collection => @repositories
153
- end
154
-
155
139
  protected
156
140
 
157
141
  def find_environment
@@ -0,0 +1,9 @@
1
+ module Katello
2
+ class Api::V2::HostContentsController < Katello::Api::V2::ApiController
3
+ def_param_group :content_facet_attributes do
4
+ param :content_view_id, Integer
5
+ param :lifecycle_environment_id, Integer
6
+ param :kickstart_repository_id, Integer, :desc => N_("Repository Id associated with the kickstart repo used for provisioning")
7
+ end
8
+ end
9
+ end
@@ -23,7 +23,7 @@ module Katello
23
23
  param :environment_id, :number, :desc => N_("Calculate Applicable Errata based on a particular Environment"), :required => false
24
24
  param_group :search, Api::V2::ApiController
25
25
  def index
26
- if (params[:content_view_id] && params[:environment_id].nil?) || (params[:environment_id] && params[:content_view_id].nil?)
26
+ if (params[:content_view_id] && params[:environment_id].nil?) || (params[:environment_id] && params[:content_view_id].nil?)
27
27
  fail _("Either both parameters 'content_view_id' and 'environment_id' should be specified or neither should be specified")
28
28
  end
29
29
 
@@ -56,7 +56,7 @@ module Katello
56
56
  api :PUT, "/hosts/:host_id/packages/upgrade_all", N_("Update packages remotely")
57
57
  param :host_id, :identifier, :required => true, :desc => N_("ID of the host")
58
58
  def upgrade_all
59
- task = async_task(::Actions::Katello::Host::Package::Update, @host, [])
59
+ task = async_task(::Actions::Katello::Host::Package::Update, @host, [])
60
60
  respond_for_async :resource => task
61
61
  end
62
62
 
@@ -4,6 +4,13 @@ module Katello
4
4
  before_filter :check_subscriptions, :only => [:add_subscriptions, :remove_subscriptions]
5
5
  before_filter :find_content_view_environment, :only => :create
6
6
 
7
+ def_param_group :subscription_facet_attributes do
8
+ param :release_version, String, :desc => N_("Release version for this Host to use (7Server, 7.1, etc)")
9
+ param :autoheal, :bool, :desc => N_("Sets whether the Host will autoheal subscriptions upon checkin")
10
+ param :service_level, Integer, :desc => N_("Service level to be used for autoheal.")
11
+ param :hypervisor_guest_uuids, Array, :desc => N_("List of hypervisor guest uuids")
12
+ end
13
+
7
14
  resource_description do
8
15
  api_version 'v2'
9
16
  api_base_url "/api"
@@ -53,6 +60,8 @@ module Katello
53
60
  param :product_id, String, :desc => N_("Product id as listed from a host's installed products, \
54
61
  this is not the same product id as the products api returns")
55
62
  param :product_name, String, :desc => N_("Product name as listed from a host's installed products")
63
+ param :arch, String, :desc => N_("Product architecture")
64
+ param :version, String, :desc => N_("Product version")
56
65
  end
57
66
  param :release_version, String, :desc => N_("Release version of the content host")
58
67
  param :service_level, String, :desc => N_("A service level for auto-healing process, e.g. SELF-SUPPORT")
@@ -81,7 +90,10 @@ module Katello
81
90
 
82
91
  if params['installed_products']
83
92
  rhsm_params[:installedProducts] = params['installed_products'].map do |product|
84
- { :productId => product['product_id'], :productName => product['product_name'] }
93
+ product_params = { :productId => product['product_id'], :productName => product['product_name'] }
94
+ product_params[:arch] = product['arch'] if product['arch']
95
+ product_params[:version] = product['version'] if product['version']
96
+ product_params
85
97
  end
86
98
  end
87
99
  rhsm_params
@@ -123,7 +135,7 @@ module Katello
123
135
  api :PUT, "/hosts/:host_id/subscriptions/content_override", N_("Set content overrides for the host")
124
136
  param :host_id, String, :desc => N_("Id of the content host"), :required => true
125
137
  param :content_label, String, :desc => N_("Label of the content"), :required => true
126
- param :value, [0, 1, "default"], :desc => N_("Override to 0/1, or 'default'"), :required => true
138
+ param :value, [0, 1, String], :desc => N_("Override to 'yes', 'no', or 'default'"), :required => true
127
139
  def content_override
128
140
  content_override = validate_content_overrides(params)
129
141
  @host.subscription_facet.candlepin_consumer.set_content_override(content_override[:content_label], 'enabled', content_override[:value])
@@ -141,18 +153,25 @@ module Katello
141
153
  respond_for_index(:collection => full_result_response(results))
142
154
  end
143
155
 
156
+ api :GET, "/hosts/:host_id/subscriptions/available_release_versions", N_("Show releases available for the content host")
157
+ param :host_id, String, :desc => N_("id of host"), :required => true
158
+ def available_release_versions
159
+ releases = @host.content_facet.try(:available_releases) || []
160
+ respond_for_index :collection => full_result_response(releases)
161
+ end
162
+
144
163
  private
145
164
 
146
165
  def validate_content_overrides(content_params)
147
- case content_params[:value].to_s
166
+ case content_params[:value].to_s.downcase
148
167
  when 'default'
149
168
  content_params[:value] = nil
150
- when '1'
169
+ when '1', 'yes'
151
170
  content_params[:value] = 1
152
- when '0'
171
+ when '0', 'no'
153
172
  content_params[:value] = 0
154
173
  else
155
- fail HttpErrors::BadRequest, _("Value must be 0/1, or 'default'")
174
+ fail HttpErrors::BadRequest, _("Value must be 'yes', 'no', or 'default'")
156
175
  end
157
176
 
158
177
  available_content = @host.subscription_facet.candlepin_consumer.available_product_content
@@ -109,6 +109,7 @@ module Katello
109
109
  :desc => N_("The type of content. The following types are supported: 'package' and 'package_group."),
110
110
  :required => true
111
111
  param :content, Array, :desc => N_("List of content (e.g. package or package group names)"), :required => true
112
+ param :update_all, :bool, :desc => N_("Updates all packages on the host(s)")
112
113
  def update_content
113
114
  content_action
114
115
  end
@@ -217,14 +218,14 @@ module Katello
217
218
  respond_for_async :resource => task
218
219
  else
219
220
  action = Katello::BulkActions.new(@hosts)
220
- job = action.send(PARAM_ACTIONS[params[:action]][params[:content_type]], params[:content])
221
+ job = action.send(PARAM_ACTIONS[params[:action]][params[:content_type]], params[:content], :update_all => params[:update_all])
221
222
  respond_for_show :template => 'job', :resource => job
222
223
  end
223
224
  end
224
225
 
225
226
  def validate_content_action
226
227
  fail HttpErrors::BadRequest, _("A content_type must be provided.") if params[:content_type].blank?
227
- fail HttpErrors::BadRequest, _("No content has been provided.") if params[:content].blank?
228
+ fail HttpErrors::BadRequest, _("No content has been provided.") if params[:content].blank? && !params[:update_all]
228
229
 
229
230
  if PARAM_ACTIONS[params[:action]][params[:content_type]].nil?
230
231
  fail HttpErrors::BadRequest, _("Invalid content type %s") % params[:content_type]
@@ -28,7 +28,7 @@ module Katello
28
28
  param :gpg_key_id, :number, :desc => N_("id of the gpg key that will be assigned to the new repository")
29
29
  param :unprotected, :bool, :desc => N_("true if this repository can be published via HTTP")
30
30
  param :content_type, RepositoryTypeManager.creatable_repository_types.keys, :required => true, :desc => N_("type of repo (either 'yum', 'puppet', 'docker', or 'ostree')")
31
- param :checksum_type, String, :desc => N_("checksum of the repository, currently 'sha1' & 'sha256' are supported.'")
31
+ param :checksum_type, String, :desc => N_("checksum of the repository, currently 'sha1' & 'sha256' are supported.")
32
32
  param :docker_upstream_name, String, :desc => N_("name of the upstream docker repository")
33
33
  param :download_policy, ["immediate", "on_demand", "background"], :desc => N_("download policy for yum repos (either 'immediate', 'on_demand', or 'background')")
34
34
  param :mirror_on_sync, :bool, :desc => N_("true if this repository when synced has to be mirrored from the source and stale rpms removed.")
@@ -36,6 +36,9 @@ module Katello
36
36
 
37
37
  api :GET, "/repositories", N_("List of enabled repositories")
38
38
  api :GET, "/content_views/:id/repositories", N_("List of repositories for a content view")
39
+ api :GET, "/organizations/:organization_id/environments/:environment_id/repositories", _("List repositories in the environment")
40
+ api :GET, "/products/:product_id/repositories", N_("List of repositories for a product")
41
+ api :GET, "/environments/:environment_id/products/:product_id/repositories", N_("List of repositories belonging to a product in an environment")
39
42
  param :organization_id, :number, :desc => N_("ID of an organization to show repositories in")
40
43
  param :product_id, :number, :desc => N_("ID of a product to show repositories of")
41
44
  param :environment_id, :number, :desc => N_("ID of an environment to show repositories in")
@@ -240,7 +243,7 @@ module Katello
240
243
  task_id = params['call_report']['task_id']
241
244
  User.current = User.anonymous_admin
242
245
 
243
- repo = Repository.where(:pulp_id => repo_id).first
246
+ repo = Repository.where(:pulp_id => repo_id).first
244
247
  fail _("Couldn't find repository '%s'") % repo_id if repo.nil?
245
248
  Rails.logger.info("Sync_complete called for #{repo.name}, running after_sync.")
246
249
 
@@ -370,7 +373,7 @@ module Katello
370
373
 
371
374
  def filter_by_content_view(query, content_view_id, environment_id, is_available_for)
372
375
  if is_available_for
373
- params[:library] = true
376
+ params[:library] = true
374
377
  sub_query = ContentViewRepository.where(:content_view_id => content_view_id).pluck(:repository_id)
375
378
  query = query.where("#{Repository.table_name}.id not in (#{sub_query.join(',')})") unless sub_query.empty?
376
379
  elsif environment_id
@@ -45,13 +45,14 @@ module Katello
45
45
  param :organization_id, :number, :desc => N_("Filter sync plans by organization name or label"), :required => true
46
46
  param_group :sync_plan
47
47
  def create
48
- sync_date = sync_plan_params[:sync_date].to_time
48
+ sync_date = sync_plan_params[:sync_date].to_time(:utc)
49
49
 
50
50
  unless sync_date.is_a?(Time)
51
51
  fail _("Date format is incorrect.")
52
52
  end
53
53
 
54
54
  @sync_plan = SyncPlan.new(sync_plan_params)
55
+ @sync_plan.sync_date = sync_date
55
56
  @sync_plan.organization = @organization
56
57
  @sync_plan.save!
57
58
 
@@ -80,18 +80,6 @@ module Katello
80
80
  respond
81
81
  end
82
82
 
83
- api :GET, "/systems/:id/releases", N_("Show releases available for the content host"), :deprecated => true
84
- param :id, String, :desc => N_("UUID of the content host"), :required => true
85
- desc <<-DESC
86
- A hint for choosing the right value for the releaseVer param
87
- DESC
88
- def releases
89
- response = { :results => @system.available_releases,
90
- :total => @system.available_releases.size,
91
- :subtotal => @system.available_releases.size }
92
- respond_for_index :collection => response
93
- end
94
-
95
83
  private
96
84
 
97
85
  def system_params_to_host_params(sys_params)
@@ -174,7 +162,7 @@ module Katello
174
162
  end
175
163
 
176
164
  def system_params(param_hash)
177
- system_params = param_hash.require(:system).permit(:name, :description, :location, :owner, :type,
165
+ system_params = param_hash.require(:system).permit(:name, :location, :owner, :type,
178
166
  :service_level, :autoheal,
179
167
  :guest_ids, :host_collection_ids => [])
180
168