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
@@ -54,7 +54,7 @@ module Katello
54
54
  end
55
55
  end
56
56
 
57
- rescue_from ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved do |e|
57
+ rescue_from ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved do |e|
58
58
  notify.exception e
59
59
  log_exception e, :info
60
60
 
@@ -168,7 +168,7 @@ module Katello
168
168
  response.headers['X-Message'] = @enc.gsub("%2B", "+")
169
169
  response.headers['X-Message-Type'] = type.to_s
170
170
  response.headers['X-Message-Request-Type'] = requested_action
171
- flash.delete(type) # clear the flash
171
+ flash.delete(type) # clear the flash
172
172
  return
173
173
  end
174
174
  end
@@ -246,6 +246,19 @@ module Katello
246
246
  render :template => "katello/common/403"
247
247
  end
248
248
 
249
+ # Parse the input provided and return the value of displayMessage. If displayMessage is not available, return "".
250
+ # (Note: this can be used to pull the displayMessage from a Candlepin exception.)
251
+ # This assumes that the input follows a syntax similar to:
252
+ # "{\"displayMessage\":\"Import is older than existing data\"}"
253
+ def self.parse_display_message(input)
254
+ unless input.nil?
255
+ if input.include? 'displayMessage'
256
+ return JSON.parse(input)['displayMessage']
257
+ end
258
+ end
259
+ input
260
+ end
261
+
249
262
  private # why bother? methods below are not testable/tested
250
263
 
251
264
  def require_org
@@ -309,9 +322,6 @@ module Katello
309
322
  User.current = nil
310
323
  end
311
324
 
312
- # TODO: break up method
313
- # rubocop:disable MethodLength
314
-
315
325
  # render bad params to user
316
326
  # @overload render_bad_parameters()
317
327
  # render bad_parameters with `default_message` and status `400`
@@ -654,19 +664,6 @@ module Katello
654
664
  logger.send level, "#{exception} (#{exception.class})\n#{exception.backtrace.join("\n")}" if exception
655
665
  end
656
666
 
657
- # Parse the input provided and return the value of displayMessage. If displayMessage is not available, return "".
658
- # (Note: this can be used to pull the displayMessage from a Candlepin exception.)
659
- # This assumes that the input follows a syntax similar to:
660
- # "{\"displayMessage\":\"Import is older than existing data\"}"
661
- def self.parse_display_message(input)
662
- unless input.nil?
663
- if input.include? 'displayMessage'
664
- return JSON.parse(input)['displayMessage']
665
- end
666
- end
667
- input
668
- end
669
-
670
667
  def default_notify_options
671
668
  {:organization => current_organization}
672
669
  end
@@ -5,6 +5,8 @@ module Katello
5
5
  include ForemanTasks::Triggers
6
6
 
7
7
  included do
8
+ alias_method_chain :action_permission, :katello
9
+
8
10
  def destroy
9
11
  sync_task(::Actions::Katello::Host::Destroy, @host)
10
12
  process_response(:object => @host)
@@ -18,14 +20,16 @@ module Katello
18
20
  @host.save!
19
21
  render(:locals => { :resource => @host }, :template => 'katello/api/v2/hosts/show', :status => 200)
20
22
  end
23
+ end
24
+
25
+ private
21
26
 
22
- def action_permission
23
- case params[:action]
24
- when 'host_collections'
25
- 'edit'
26
- else
27
- super
28
- end
27
+ def action_permission_with_katello
28
+ case params[:action]
29
+ when 'host_collections'
30
+ 'edit'
31
+ else
32
+ action_permission_without_katello
29
33
  end
30
34
  end
31
35
  end
@@ -33,7 +33,7 @@ module Katello
33
33
  if default_sort.is_a?(Array)
34
34
  sort_options = default_sort
35
35
  elsif default_sort.is_a?(Proc)
36
- options[:custom_sort] = default_sort
36
+ options[:custom_sort] = default_sort
37
37
  else
38
38
  fail "Unsupported default_sort type"
39
39
  end
@@ -37,7 +37,7 @@ module Katello
37
37
  :key_environment_id,
38
38
  :content_view_version_ids => [],
39
39
  :environment_ids => []
40
- )
40
+ )
41
41
  options = options.reject { |_k, v| v.blank? }
42
42
 
43
43
  authorize_remove_versions(view, options) &&
@@ -30,7 +30,7 @@ module Katello
30
30
  sync_task(::Actions::Katello::Organization::Create, @taxonomy)
31
31
  @taxonomy.reload
32
32
  if @count_nil_hosts > 0
33
- redirect_to send("step2_#{taxonomy_single}_path", @taxonomy)
33
+ redirect_to send("step2_#{taxonomy_single}_path", @taxonomy)
34
34
  else
35
35
  process_success(:object => @taxonomy, :success_redirect => send("edit_#{taxonomy_single}_path", @taxonomy))
36
36
  end
@@ -19,7 +19,7 @@ module Katello
19
19
  rescue ::Foreman::WrappedException => e
20
20
  Rails.logger.warn _('Error connecting. Got: %s') % e
21
21
  respond_to do |format|
22
- format.html { render :text => _('Error retrieving Pulp storage') }
22
+ format.html { render :text => _('Error retrieving Pulp storage') }
23
23
  format.json { render :json => {:success => false, :message => e} }
24
24
  end
25
25
  end
@@ -30,7 +30,7 @@ module Katello
30
30
  if @pulp_status['fatal']
31
31
  Rails.logger.warn @pulp_status['fatal']
32
32
  respond_to do |format|
33
- format.html { render :text => _('Error connecting to Pulp service') }
33
+ format.html { render :text => _('Error connecting to Pulp service') }
34
34
  format.json { render :json => {:success => false, :message => @pulp_status['fatal']} }
35
35
  end
36
36
  else
@@ -103,7 +103,7 @@ module Katello
103
103
  end
104
104
 
105
105
  def notification_polling_time
106
- time = 120
106
+ time = 120
107
107
  return time.to_i * 1_000 if time
108
108
  return 120_000
109
109
  end
@@ -16,7 +16,8 @@ module Katello
16
16
  'katello_default_ptable',
17
17
  'katello_default_PXELinux',
18
18
  'katello_default_user_data',
19
- 'katello_default_kexec'
19
+ 'katello_default_kexec',
20
+ 'katello_default_atomic_provision'
20
21
  ].include?(setting.name)
21
22
 
22
23
  case setting.name
@@ -26,7 +27,7 @@ module Katello
26
27
  edit_select(setting, :value, :select_values => katello_template_setting_values("finish"))
27
28
  when "katello_default_iPXE"
28
29
  edit_select(setting, :value, :select_values => katello_template_setting_values("iPXE"))
29
- when "katello_default_provision"
30
+ when "katello_default_provision", "katello_default_atomic_provision"
30
31
  edit_select(setting, :value, :select_values => katello_template_setting_values("provision"))
31
32
  when "katello_default_ptable"
32
33
  edit_select(setting, :value, :select_values => Hash[Template.all.where(:type => "Ptable").map { |tmp| [tmp[:name], tmp[:name]] }].to_json)
@@ -215,7 +215,7 @@ module Katello
215
215
  :content_view_id => content_view.id)
216
216
  host.content_source = SmartProxy.find(params[:content_source_id])
217
217
  if host.operatingsystem.is_a?(Redhat)
218
- view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
218
+ view_options = host.operatingsystem.kickstart_repos(host).map { |repo| OpenStruct.new(repo) }
219
219
  end
220
220
  end
221
221
  view_options
@@ -132,7 +132,7 @@ module Katello
132
132
  end
133
133
 
134
134
  def field_label(name, options)
135
- required = object.class.validators_on(name).any? do|v|
135
+ required = object.class.validators_on(name).any? do |v|
136
136
  v.is_a? ActiveModel::Validations::PresenceValidator
137
137
  end
138
138
 
@@ -1,8 +1,8 @@
1
1
  module Katello
2
2
  module KatelloUrlHelper
3
3
  unless defined? CONSTANTS_DEFINED
4
- FILEPREFIX = ['file']
5
- PROTOCOLS = ['http', 'https', 'ftp']
4
+ FILEPREFIX = ['file'].freeze
5
+ PROTOCOLS = ['http', 'https', 'ftp'].freeze
6
6
 
7
7
  CONSTANTS_DEFINED = true
8
8
  end
@@ -6,8 +6,8 @@ module Actions
6
6
 
7
7
  class CandlepinListeningService
8
8
  RECONNECT_ATTEMPTS = 30
9
- TIMEOUT = Qpid::Messaging::Duration::SECOND
10
- NO_MESSAGE_AVAILABLE_ERROR_TYPE = 'NoMessageAvailable'
9
+ TIMEOUT = Qpid::Messaging::Duration::SECOND
10
+ NO_MESSAGE_AVAILABLE_ERROR_TYPE = 'NoMessageAvailable'.freeze
11
11
 
12
12
  class << self
13
13
  attr_reader :instance
@@ -77,7 +77,7 @@ module Actions
77
77
  message = fetch_message
78
78
  if message[:result]
79
79
  result = message[:result]
80
- @session.acknowledge(:message => result)
80
+ @session.acknowledge(:message => result, :sync => true)
81
81
  suspended_action.notify_message_received(result.message_id, result.subject, result.content)
82
82
  elsif message[:error]
83
83
  suspended_action.notify_not_connected(message[:error])
@@ -7,11 +7,17 @@ module Actions
7
7
  input_format do
8
8
  param :uuid, String
9
9
  param :entitlement_id, String
10
+ param :pool_id, String
10
11
  end
11
12
 
12
13
  def run
13
14
  ::Katello::Resources::Candlepin::Consumer.remove_entitlement(input[:uuid], input[:entitlement_id])
14
15
  end
16
+
17
+ def finalize
18
+ pool = ::Katello::Pool.where(:cp_id => input[:pool_id]).first
19
+ pool.import_data if pool
20
+ end
15
21
  end
16
22
  end
17
23
  end
@@ -45,7 +45,8 @@ module Actions
45
45
  private
46
46
 
47
47
  def import_or_remove_pool(pool_id)
48
- ::Katello::Pool.find_by(:cp_id => pool_id).import_data
48
+ pool = ::Katello::Pool.find_by(:cp_id => pool_id)
49
+ pool.nil? ? remove_pool(pool_id) : pool.import_data
49
50
  rescue RestClient::ResourceNotFound
50
51
  remove_pool(pool_id)
51
52
  end
@@ -8,7 +8,7 @@ module Actions
8
8
 
9
9
  current_repos_on_capsule = capsule_content.current_repositories(environment, content_view)
10
10
  list_of_repos_to_sync = capsule_content.repos_available_to_capsule(environment, content_view)
11
- need_creation = list_of_repos_to_sync - current_repos_on_capsule
11
+ need_creation = list_of_repos_to_sync - current_repos_on_capsule
12
12
 
13
13
  need_creation.each do |repo|
14
14
  create_repo_in_pulp(capsule_content, repo)
@@ -11,6 +11,7 @@ module Actions
11
11
  end
12
12
 
13
13
  def plan(capsule_content, options = {})
14
+ capsule_content.ping_pulp
14
15
  action_subject(capsule_content.capsule)
15
16
 
16
17
  environment = options.fetch(:environment, nil)
@@ -29,12 +30,10 @@ module Actions
29
30
 
30
31
  plan_action(ConfigureCapsule, capsule_content, environment, content_view)
31
32
 
32
- smart_proxy = SmartProxy.where(:content_host_id => capsule_content.consumer.id).first
33
- fail _("Smart Proxy not found for capsule.") unless smart_proxy
34
33
  concurrence do
35
34
  repository_ids.each do |repo_id|
36
35
  plan_action(Pulp::Consumer::SyncCapsule,
37
- capsule_id: smart_proxy.id,
36
+ capsule_id: capsule_content.capsule.id,
38
37
  repo_pulp_id: repo_id)
39
38
  end
40
39
  end
@@ -81,8 +80,8 @@ module Actions
81
80
  repos.select do |repo|
82
81
  repo_details = capsule.pulp_repo_facts(repo.pulp_id)
83
82
  next unless repo_details
84
- capsule_importer = repo_details["importers"][0].try(:[], "config")
85
- capsule_importer.nil? || !(repo.importer_matches?(capsule_importer))
83
+ capsule_importer = repo_details["importers"][0]
84
+ !(repo.importer_matches?(capsule_importer))
86
85
  end
87
86
  end
88
87
 
@@ -14,7 +14,7 @@ module Actions
14
14
  users = ::User.select { |user| user.receives?(:katello_promote_errata) && user.can?(:view_content_views, content_view) }
15
15
 
16
16
  begin
17
- MailNotification[:katello_promote_errata].deliver(:users => users, :content_view => content_view, :environment => environment) unless users.blank?
17
+ MailNotification[:katello_promote_errata].deliver_now(:users => users, :content_view => content_view, :environment => environment) unless users.blank?
18
18
  rescue => e
19
19
  message = _('Unable to send errata e-mail notification: %{error}' % {:error => e})
20
20
  Rails.logger.error(message)
@@ -7,7 +7,7 @@ module Actions
7
7
  ::Katello::Erratum::CONTENT_TYPE => "Errata",
8
8
  ::Katello::Rpm::CONTENT_TYPE => "Packages",
9
9
  ::Katello::PuppetModule::CONTENT_TYPE => "Puppet Modules"
10
- }
10
+ }.freeze
11
11
 
12
12
  def humanized_output
13
13
  if action.output[:changed_content]
@@ -1,3 +1,4 @@
1
+ # rubocop:disable HandleExceptions
1
2
  module Actions
2
3
  module Katello
3
4
  module ContentView
@@ -43,9 +44,13 @@ module Actions
43
44
  end
44
45
 
45
46
  def run
46
- ForemanTasks.async_task(ContentView::CapsuleGenerateAndSync,
47
- ::Katello::ContentView.find(input[:content_view_id]),
48
- ::Katello::KTEnvironment.find(input[:environment_id]))
47
+ environment = ::Katello::KTEnvironment.find(input[:environment_id])
48
+ if ::Katello::CapsuleContent.sync_needed?(environment)
49
+ ForemanTasks.async_task(ContentView::CapsuleGenerateAndSync,
50
+ ::Katello::ContentView.find(input[:content_view_id]),
51
+ environment)
52
+ end
53
+ rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to
49
54
  end
50
55
 
51
56
  def rescue_strategy_for_self
@@ -1,3 +1,4 @@
1
+ # rubocop:disable HandleExceptions
1
2
  module Actions
2
3
  module Katello
3
4
  module ContentView
@@ -49,9 +50,13 @@ module Actions
49
50
  end
50
51
 
51
52
  def run
52
- ForemanTasks.async_task(ContentView::CapsuleGenerateAndSync,
53
- ::Katello::ContentView.find(input[:content_view_id]),
54
- ::Katello::KTEnvironment.find(input[:environment_id]))
53
+ environment = ::Katello::KTEnvironment.find(input[:environment_id])
54
+ if ::Katello::CapsuleContent.sync_needed?(environment)
55
+ ForemanTasks.async_task(ContentView::CapsuleGenerateAndSync,
56
+ ::Katello::ContentView.find(input[:content_view_id]),
57
+ environment)
58
+ end
59
+ rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to
55
60
  end
56
61
 
57
62
  def rescue_strategy_for_self
@@ -111,13 +111,13 @@ module Actions
111
111
  def system_cve(options)
112
112
  ::Katello::ContentViewEnvironment.where(:environment_id => options[:system_environment_id],
113
113
  :content_view_id => options[:system_content_view_id]
114
- ).first
114
+ ).first
115
115
  end
116
116
 
117
117
  def activation_key_cve(options)
118
118
  ::Katello::ContentViewEnvironment.where(:environment_id => options[:key_environment_id],
119
119
  :content_view_id => options[:key_content_view_id]
120
- ).first
120
+ ).first
121
121
  end
122
122
  end
123
123
  end
@@ -195,7 +195,7 @@ module Actions
195
195
  puppet_module = find_puppet_modules([module_id]).first
196
196
  possible_repos = puppet_module.repositories.in_organization(new_repo.organization).in_default_view
197
197
  plan_action(Pulp::Repository::CopyPuppetModule, :source_pulp_id => possible_repos.first.pulp_id,
198
- :target_pulp_id => new_repo.pulp_id, :clauses => {'unit_id' => puppet_module.uuid}, :include_result => true)
198
+ :target_pulp_id => new_repo.pulp_id, :clauses => {'unit_id' => puppet_module.uuid}, :include_result => true)
199
199
  end
200
200
 
201
201
  def plan_copy(action_class, source_repo, target_repo, clauses = nil, override_config = nil)
@@ -13,7 +13,7 @@ module Actions
13
13
  end
14
14
 
15
15
  def humanized_name
16
- if input[:hostname]
16
+ if input.try(:[], :hostname).nil?
17
17
  _("Install Applicable Errata")
18
18
  else
19
19
  _("Install Applicable Errata on %s") % input[:hostname]
@@ -15,7 +15,7 @@ module Actions
15
15
  def finalize
16
16
  ::Host.where(:id => input[:host_ids]).each do |host|
17
17
  host.content_facet.try(:import_applicability)
18
- host.get_status(::Katello::ErrataStatus).refresh!
18
+ host.content_facet.update_errata_status
19
19
  end
20
20
  end
21
21
  end
@@ -9,6 +9,10 @@ module Actions
9
9
  :hypervisor_results => hypervisor_results)
10
10
  end
11
11
 
12
+ def run
13
+ output[:results] = input[:results]
14
+ end
15
+
12
16
  def finalize
13
17
  environment = ::Katello::KTEnvironment.find(input[:environment_id])
14
18
  content_view = ::Katello::ContentView.find(input[:content_view_id])
@@ -29,19 +33,20 @@ module Actions
29
33
  # Since host names must be unique yet hypervisors may have unique subscription
30
34
  # facets in different orgs
31
35
  duplicate_name = "virt-who-#{name}-#{content_view.organization.id}"
32
- host = ::Host.find_by(:name => name)
36
+ host = find_host_by_uuid_or_name(hypervisor_json)
33
37
  if host
34
- fail _("Host '%{name}' does not belong to an organization" % name) unless host.organization
38
+ fail _("Host '%{name}' does not belong to an organization") % {:name => name} unless host.organization
35
39
  if host.organization.id != content_view.organization.id
36
40
  name = duplicate_name
41
+ host = nil
37
42
  end
38
- elsif ::Host.find_by(:name => name)
43
+ else
39
44
  name = duplicate_name
40
45
  end
41
46
 
42
- host = ::Katello::Host::SubscriptionFacet.find_or_create_host_for_hypervisor(name,
43
- content_view.organization)
47
+ host ||= create_host_for_hypervisor(name, content_view.organization)
44
48
  host.subscription_facet ||= ::Katello::Host::SubscriptionFacet.new
49
+ host.subscription_facet.host_id = host.id
45
50
  host.subscription_facet.update_from_consumer_attributes(hypervisor_json)
46
51
  host.subscription_facet.uuid = hypervisor_json[:uuid]
47
52
  host.subscription_facet.save!
@@ -61,6 +66,19 @@ module Actions
61
66
 
62
67
  host.save!
63
68
  end
69
+
70
+ def find_host_by_uuid_or_name(hypervisor_json)
71
+ facet = ::Katello::Host::SubscriptionFacet.find_by(:uuid => hypervisor_json[:uuid])
72
+ facet.nil? ? ::Host.find_by(:name => hypervisor_json[:name]) : facet.host
73
+ end
74
+
75
+ def create_host_for_hypervisor(name, organization, location = nil)
76
+ location ||= Location.default_location
77
+ host = ::Host::Managed.new(:name => name, :organization => organization,
78
+ :location => location, :managed => false)
79
+ host.save!
80
+ host
81
+ end
64
82
  end
65
83
  end
66
84
  end