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
@@ -57,23 +57,14 @@ module Actions
57
57
  host.subscription_facet.update_from_consumer_attributes(host.subscription_facet.candlepin_consumer.
58
58
  consumer_attributes.except(:installedProducts, :guestIds, :facts))
59
59
  host.subscription_facet.save!
60
- connect_to_smart_proxy(host)
60
+ host.subscription_facet.update_subscription_status
61
+ host.refresh_global_status!
61
62
 
62
63
  system = ::Katello::System.find(input[:system_id])
63
64
  system.uuid = input[:uuid]
64
65
  system.save!
65
66
  end
66
67
 
67
- def connect_to_smart_proxy(system)
68
- smart_proxy = SmartProxy.where(:name => system.name).first
69
-
70
- if smart_proxy
71
- smart_proxy.content_host = system.content_host
72
- smart_proxy.organizations << system.organization unless smart_proxy.organizations.include?(system.organization)
73
- smart_proxy.save!
74
- end
75
- end
76
-
77
68
  private
78
69
 
79
70
  def set_host_collections(host, activation_keys)
@@ -9,7 +9,7 @@ module Actions
9
9
 
10
10
  entitlements.each do |entitlement|
11
11
  plan_action(::Actions::Candlepin::Consumer::RemoveSubscription, :uuid => host.subscription_facet.uuid,
12
- :entitlement_id => entitlement['id'])
12
+ :entitlement_id => entitlement['id'], :pool_id => entitlement['pool']['id'])
13
13
  plan_self(:host_name => host.name)
14
14
  end
15
15
  end
@@ -17,7 +17,7 @@ module Actions
17
17
  else
18
18
  consumer_params = host.subscription_facet.consumer_attributes
19
19
  end
20
- ::Katello::Host::SubscriptionFacet.update_facts(host, consumer_params[:facts]) unless consumer_params[:facts].blank?
20
+ ::Katello::Host::SubscriptionFacet.update_facts(::Host.find(host.id), consumer_params[:facts]) unless consumer_params[:facts].blank?
21
21
  host.subscription_facet.save!
22
22
  plan_action(::Actions::Candlepin::Consumer::Update, host.subscription_facet.uuid, consumer_params)
23
23
  end
@@ -14,7 +14,11 @@ module Actions
14
14
  end
15
15
 
16
16
  def humanized_name
17
- _("Update for host %s") % input[:hostname]
17
+ if input.try(:[], :hostname).nil?
18
+ _("Update for host")
19
+ else
20
+ _("Update for host %s") % input[:hostname]
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -17,7 +17,7 @@ module Actions
17
17
  errata = ::Katello::Erratum.where(:id => repo.repository_errata.where('katello_repository_errata.updated_at > ?', input[:last_updated].to_datetime).pluck(:erratum_id))
18
18
 
19
19
  begin
20
- MailNotification[:katello_sync_errata].deliver(:users => users, :repo => repo, :errata => errata) unless users.blank?
20
+ MailNotification[:katello_sync_errata].deliver_now(:users => users, :repo => repo, :errata => errata) unless users.blank?
21
21
  rescue => e
22
22
  message = _('Unable to send errata e-mail notification: %{error}' % {:error => e})
23
23
  Rails.logger.error(message)
@@ -9,7 +9,7 @@ module Actions
9
9
  param :export_result, Hash
10
10
  end
11
11
 
12
- EXPORT_OUTPUT_BASEDIR = "/var/lib/pulp/published/yum/master/group_export_distributor/"
12
+ EXPORT_OUTPUT_BASEDIR = "/var/lib/pulp/published/yum/master/group_export_distributor/".freeze
13
13
 
14
14
  def plan(repos, export_to_iso, since, iso_size, group_id)
15
15
  unless File.directory?(Setting['pulp_export_destination'])
@@ -1,3 +1,4 @@
1
+ # rubocop:disable HandleExceptions
1
2
  module Actions
2
3
  module Katello
3
4
  module Repository
@@ -51,6 +52,7 @@ module Actions
51
52
 
52
53
  def run
53
54
  ForemanTasks.async_task(Repository::CapsuleGenerateAndSync, ::Katello::Repository.find(input[:id]))
55
+ rescue ::Katello::Errors::CapsuleCannotBeReached # skip any capsules that cannot be connected to
54
56
  end
55
57
 
56
58
  def humanized_name
@@ -4,7 +4,7 @@ module Actions
4
4
  include Actions::Base::Polling
5
5
  include ::Dynflow::Action::Cancellable
6
6
 
7
- FINISHED_STATES = %w(finished error canceled skipped)
7
+ FINISHED_STATES = %w(finished error canceled skipped).freeze
8
8
 
9
9
  # A call report (documented http://pulp-dev-guide.readthedocs.org/en/latest/conventions/sync-v-async.html)
10
10
  # Looks like: {
@@ -0,0 +1,76 @@
1
+ module Actions
2
+ module Pulp
3
+ class AbstractAsyncTaskGroup < Pulp::Abstract
4
+ include Actions::Base::Polling
5
+
6
+ # A call report (documented https://github.com/pulp/pulp/blob/master/docs/dev-guide/integration/rest-api/consumer/applicability.rst#id65)
7
+ # Looks like:
8
+ # {
9
+ # "_href": "/pulp/api/v2/task_groups/7744e2df-39b9-46f0-bb10-feffa2f7014b/",
10
+ # "group_id": "7744e2df-39b9-46f0-bb10-feffa2f7014b"
11
+ # }
12
+ #
13
+ # A TaskGroup (https://github.com/pulp/pulp/blob/master/docs/dev-guide/integration/rest-api/tasks.rst#task-group-management)
14
+ # Looks like:
15
+ # {
16
+ # "accepted": 0,
17
+ # "finished": 100,
18
+ # "running": 4,
19
+ # "canceled": 0,
20
+ # "waiting": 2,
21
+ # "skipped": 0,
22
+ # "suspended": 0,
23
+ # "error": 0,
24
+ # "total": 106
25
+ # }
26
+
27
+ def run(event = nil)
28
+ # do nothing when the action is being skipped
29
+ unless event == Dynflow::Action::Skip
30
+ super
31
+ end
32
+ end
33
+
34
+ def humanized_state
35
+ case state
36
+ when :running
37
+ if self.external_task.nil?
38
+ _("initiating Pulp task")
39
+ else
40
+ _("checking Pulp task status")
41
+ end
42
+ else
43
+ super
44
+ end
45
+ end
46
+
47
+ def done?
48
+ finishing_states = ["finished", "canceled", "skipped", "suspended", "error"]
49
+ return false if (finishing_states - external_task.keys).present?
50
+ task_resource.completed?(external_task)
51
+ end
52
+
53
+ def external_task
54
+ output["pulp_task_group"]
55
+ end
56
+
57
+ private
58
+
59
+ def external_task=(external_task_data)
60
+ if external_task_data.key?("group_id")
61
+ output["pulp_task_group"] = {"group_id" => external_task_data["group_id"]}
62
+ else
63
+ output["pulp_task_group"] = {"group_id" => output["pulp_task_group"]["group_id"]}.merge(external_task_data)
64
+ end
65
+ end
66
+
67
+ def poll_external_task
68
+ task_resource.summary(output["pulp_task_group"]["group_id"])
69
+ end
70
+
71
+ def task_resource
72
+ ::Katello.pulp_server.resources.task_group
73
+ end
74
+ end
75
+ end
76
+ end
@@ -10,7 +10,7 @@ module Actions
10
10
  end
11
11
 
12
12
  def run
13
- response = pulp_extensions.consumer.create(input[:uuid], display_name: input[:name])
13
+ response = pulp_extensions.consumer.create(input[:uuid], display_name: input[:name])
14
14
  output[:response] = response.slice(:uuid, :name)
15
15
  end
16
16
  end
@@ -9,7 +9,8 @@ module Actions
9
9
  if sync_plan.nil?
10
10
  plan_action(::Actions::Pulp::Repository::RemoveSchedule, :repo_id => repo.id)
11
11
  else
12
- plan_action(::Actions::Pulp::Repository::UpdateSchedule,
12
+ plan_action(
13
+ ::Actions::Pulp::Repository::UpdateSchedule,
13
14
  :repo_id => repo.id,
14
15
  :schedule => sync_plan.schedule_format,
15
16
  :enabled => sync_plan.enabled
@@ -13,6 +13,10 @@ module Actions
13
13
  def invoke_external_task
14
14
  pulp_resources.repository.associate_importer(*input.values_at(:repo_id, :type_id, :config))
15
15
  end
16
+
17
+ def run_progress_weight
18
+ 0.01
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -16,10 +16,6 @@ module Actions
16
16
  input[:unit_key],
17
17
  unit_metadata: {})
18
18
  end
19
-
20
- def rescue_strategy
21
- Dynflow::Action::Rescue::Skip
22
- end
23
19
  end
24
20
  end
25
21
  end
@@ -15,25 +15,24 @@ module Actions
15
15
 
16
16
  def update_or_associate_importer(capsule_id, repository, repository_details)
17
17
  existing_importers = repository_details["importers"]
18
- importer = capsule_id ? repository.generate_importer(true) : repository.generate_importer
19
- importer_config = capsule_id ? importer.config.merge!(importer_certs(repository)) : importer.config
18
+ importer = repository.generate_importer(!capsule_id.nil?)
20
19
  found = existing_importers.find { |i| i['importer_type_id'] == importer.id }
21
20
 
22
21
  if found
23
22
  plan_action(::Actions::Pulp::Repository::UpdateImporter,
24
23
  :repo_id => repository.pulp_id,
25
24
  :id => found['id'],
26
- :config => importer_config,
25
+ :config => importer.config,
27
26
  :capsule_id => capsule_id
28
- )
27
+ )
29
28
  else
30
29
  plan_action(::Actions::Pulp::Repository::AssociateImporter,
31
30
  :repo_id => repository.pulp_id,
32
31
  :type_id => repository.importers.first['importer_type_id'],
33
- :config => importer_config,
32
+ :config => importer.config,
34
33
  :capsule_id => capsule_id,
35
34
  :hash => { :importer_id => importer.id }
36
- )
35
+ )
37
36
  end
38
37
  end
39
38
 
@@ -48,7 +47,7 @@ module Actions
48
47
  :id => found['id'],
49
48
  :config => distributor.config,
50
49
  :capsule_id => capsule_id
51
- )
50
+ )
52
51
  else
53
52
  plan_action(::Actions::Pulp::Repository::AssociateDistributor,
54
53
  :repo_id => repository.pulp_id,
@@ -56,7 +55,7 @@ module Actions
56
55
  :config => distributor.config,
57
56
  :capsule_id => capsule_id,
58
57
  :hash => { :distributor_id => distributor.id }
59
- )
58
+ )
60
59
  end
61
60
  end
62
61
  end
@@ -77,16 +76,6 @@ module Actions
77
76
  end
78
77
  end
79
78
  end
80
-
81
- def importer_certs(repository)
82
- ueber_cert = ::Cert::Certs.ueber_cert(repository.organization)
83
-
84
- {
85
- :ssl_ca_cert => ::Cert::Certs.ca_cert,
86
- :ssl_client_cert => ueber_cert[:cert],
87
- :ssl_client_key => ueber_cert[:key]
88
- }
89
- end
90
79
  end
91
80
  end
92
81
  end
@@ -1,7 +1,7 @@
1
1
  module Actions
2
2
  module Pulp
3
3
  module Repository
4
- class RegenerateApplicability < Pulp::AbstractAsyncTask
4
+ class RegenerateApplicability < Pulp::AbstractAsyncTaskGroup
5
5
  middleware.use Actions::Middleware::ExecuteIfContentsChanged
6
6
 
7
7
  input_format do
@@ -10,7 +10,7 @@ module Actions
10
10
  end
11
11
 
12
12
  def invoke_external_task
13
- pulp_extensions.repository.regenerate_applicability_by_ids([input[:pulp_id]])
13
+ pulp_extensions.repository.regenerate_applicability_by_ids([input[:pulp_id]], true)
14
14
  end
15
15
  end
16
16
  end
@@ -31,7 +31,7 @@ module Actions
31
31
  sync_options[:validate] = !(SETTINGS[:katello][:pulp][:skip_checksum_validation])
32
32
 
33
33
  output[:pulp_tasks] = pulp_tasks =
34
- [pulp_resources.repository.sync(input[:pulp_id], override_config: sync_options)]
34
+ [pulp_resources.repository.sync(input[:pulp_id], override_config: sync_options)]
35
35
 
36
36
  pulp_tasks
37
37
  end
@@ -13,6 +13,10 @@ module Actions
13
13
  output[:response] = pulp_resources.repository.
14
14
  update_importer(*input.values_at(:repo_id, :id, :config))
15
15
  end
16
+
17
+ def run_progress_weight
18
+ 0.01
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -58,7 +58,7 @@ module Katello
58
58
  # TODO: why not use http_code from the exception???
59
59
  render :json => format_subsys_exception_hash(exception), :status => :bad_request
60
60
  else
61
- respond_for_exception(exception, :status => :bad_request)
61
+ respond_for_exception(exception, :status => :bad_request)
62
62
  end
63
63
  end
64
64
 
@@ -6,43 +6,42 @@ module Katello
6
6
  @consumer_ids = hosts.map { |host| host.content_facet.try(:uuid) }.compact
7
7
  end
8
8
 
9
- def install_packages(packages)
9
+ def install_packages(packages, _options = {})
10
10
  fail Errors::EmptyBulkActionException if self.consumer_ids.empty?
11
11
  perform_bulk_action do |consumer_group|
12
12
  consumer_group.install_package(packages)
13
13
  end
14
14
  end
15
15
 
16
- def uninstall_packages(packages)
16
+ def uninstall_packages(packages, _options = {})
17
17
  fail Errors::EmptyBulkActionException if self.consumer_ids.empty?
18
18
  perform_bulk_action do |consumer_group|
19
19
  consumer_group.uninstall_package(packages)
20
20
  end
21
21
  end
22
22
 
23
- def update_packages(packages = nil)
24
- # if no packages are provided, a full system update will be performed (e.g ''yum update' equivalent)
23
+ def update_packages(packages = nil, options = {})
25
24
  fail Errors::EmptyBulkActionException if self.consumer_ids.empty?
26
25
  perform_bulk_action do |consumer_group|
27
- consumer_group.update_package(packages)
26
+ consumer_group.update_package(packages, options)
28
27
  end
29
28
  end
30
29
 
31
- def install_package_groups(groups)
30
+ def install_package_groups(groups, _options = {})
32
31
  fail Errors::EmptyBulkActionException if self.consumer_ids.empty?
33
32
  perform_bulk_action do |consumer_group|
34
33
  consumer_group.install_package_group(groups)
35
34
  end
36
35
  end
37
36
 
38
- def update_package_groups(groups)
37
+ def update_package_groups(groups, _options = {})
39
38
  fail Errors::EmptyBulkActionException if self.consumer_ids.empty?
40
39
  perform_bulk_action do |consumer_group|
41
40
  consumer_group.install_package_group(groups)
42
41
  end
43
42
  end
44
43
 
45
- def uninstall_package_groups(groups)
44
+ def uninstall_package_groups(groups, _options = {})
46
45
  fail Errors::EmptyBulkActionException if self.consumer_ids.empty?
47
46
  perform_bulk_action do |consumer_group|
48
47
  consumer_group.uninstall_package_group(groups)
@@ -47,16 +47,6 @@ module Katello
47
47
  scope
48
48
  end
49
49
 
50
- delegate :uuid, :to => :consumer, :prefix => true
51
-
52
- def consumer
53
- @consumer ||= @capsule.content_host
54
- unless @consumer
55
- fail Errors::CapsuleContentMissingConsumer, _("Could not find Content Host with exact name '%s', verify the Capsule is registered with that name.") % @capsule.name
56
- end
57
- @consumer
58
- end
59
-
60
50
  def sync_tasks
61
51
  ForemanTasks::Task.for_resource(self.capsule)
62
52
  end
@@ -142,7 +132,7 @@ module Katello
142
132
  end
143
133
 
144
134
  def pulp_url
145
- self.capsule.url + "/pulp/api/v2/"
135
+ "https://" + self.capsule.hostname + "/pulp/api/v2/"
146
136
  end
147
137
 
148
138
  def pulp_repo_facts(pulp_id)
@@ -151,6 +141,12 @@ module Katello
151
141
  nil
152
142
  end
153
143
 
144
+ def ping_pulp
145
+ ::Katello::Ping.pulp_without_auth(self.pulp_url)
146
+ rescue Errno::EHOSTUNREACH, Errno::ECONNREFUSED, RestClient::Exception => error
147
+ raise ::Katello::Errors::CapsuleCannotBeReached, _("%s is unreachable. %s" % [@capsule.name, error])
148
+ end
149
+
154
150
  def self.with_environment(environment, include_default = false)
155
151
  features = [SmartProxy::PULP_NODE_FEATURE]
156
152
  features << SmartProxy::PULP_FEATURE if include_default
@@ -165,5 +161,9 @@ module Katello
165
161
  proxy = SmartProxy.with_features(SmartProxy::PULP_FEATURE).first
166
162
  self.new(proxy) if proxy
167
163
  end
164
+
165
+ def self.sync_needed?(environment)
166
+ ::Katello::CapsuleContent.with_environment(environment).any?
167
+ end
168
168
  end
169
169
  end
@@ -47,6 +47,8 @@ module Katello
47
47
 
48
48
  class OrganizationDestroyException < StandardError; end
49
49
 
50
+ class CapsuleCannotBeReached < StandardError; end
51
+
50
52
  class UnsupportedActionException < StandardError
51
53
  attr_reader :action, :receiver
52
54