katello 3.4.0.rc2 → 3.4.0

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_dynflow_proxy_controller.rb +43 -0
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +20 -14
  4. data/app/controllers/katello/api/v2/content_views_controller.rb +2 -2
  5. data/app/controllers/katello/api/v2/errata_controller.rb +1 -0
  6. data/app/controllers/katello/api/v2/packages_controller.rb +6 -2
  7. data/app/lib/actions/candlepin/async_hypervisors.rb +22 -0
  8. data/app/lib/actions/candlepin/import_pool_handler.rb +19 -23
  9. data/app/lib/actions/katello/capsule_content/sync.rb +1 -0
  10. data/app/lib/actions/katello/host/hypervisors.rb +16 -4
  11. data/app/lib/actions/katello/host/hypervisors_update.rb +2 -2
  12. data/app/lib/actions/katello/host/upload_package_profile.rb +13 -6
  13. data/app/lib/actions/katello/repository/remove_content.rb +8 -8
  14. data/app/lib/actions/middleware/backend_services_check.rb +2 -2
  15. data/app/lib/katello/capsule_content.rb +6 -0
  16. data/app/lib/katello/resources/candlepin.rb +12 -7
  17. data/app/models/katello/concerns/organization_extensions.rb +4 -0
  18. data/app/models/katello/events/import_pool.rb +17 -0
  19. data/app/models/katello/glue/candlepin/owner.rb +4 -0
  20. data/app/models/katello/host/subscription_facet.rb +9 -2
  21. data/app/models/katello/ping.rb +4 -4
  22. data/app/models/katello/subscription_status.rb +5 -2
  23. data/app/services/cert/certs.rb +7 -0
  24. data/config/routes/api/rhsm.rb +4 -2
  25. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-details.html +2 -1
  26. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-host-collections-table.html +4 -6
  27. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/details/views/activation-key-info.html +2 -2
  28. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/activation-keys/new/views/activation-key-new.html +1 -1
  29. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-details.html +1 -0
  30. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +1 -1
  31. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/filters/views/filter-repositories.html +0 -1
  32. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/new/views/content-view-new.html +1 -1
  33. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tag-environments.html +4 -11
  34. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/gpg-keys/new/views/new-gpg-key.html +1 -1
  35. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/new/views/new-host-collection.html +1 -1
  36. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/views/new-repository.html +1 -1
  37. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +1 -1
  38. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/new/new-sync-plan-modal.controller.js +46 -0
  39. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/new/product-form.controller.js +15 -2
  40. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/new/views/new-sync-plan-modal.html +18 -0
  41. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/new/views/product-new-form.html +40 -38
  42. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/products.routes.js +0 -19
  43. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/content-access-mode-banner.directive.js +22 -0
  44. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-details.html +2 -1
  45. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest-import.html +1 -1
  46. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest.html +2 -0
  47. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/views/content-access-mode-banner.html +5 -0
  48. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/details/views/sync-plan-info.html +0 -3
  49. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js +16 -24
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/views/new-sync-plan-form.html +52 -48
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/views/new-sync-plan.html +3 -1
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js +66 -0
  53. data/lib/katello/engine.rb +10 -0
  54. data/lib/katello/params_parser_wrapper.rb +16 -0
  55. data/lib/katello/permissions/host_permissions.rb +7 -3
  56. data/lib/katello/plugin.rb +4 -4
  57. data/lib/katello/tasks/regenerate_ueber_certs.rake +1 -1
  58. data/lib/katello/tasks/repository.rake +23 -0
  59. data/lib/katello/version.rb +1 -1
  60. metadata +13 -5
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-new-sync-plan.html +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3f9bb83c71845a3ecc9adb445e0204dd621f628
4
- data.tar.gz: a6d9abc07ba6af4f223702bcb98eb8c920fe3397
3
+ metadata.gz: 7ca8f57b46bc9721e4c1fa328d529bbe1648c8c0
4
+ data.tar.gz: f307460b4ff1f4239a751a9bc9a85fe851372cb4
5
5
  SHA512:
6
- metadata.gz: dc4d63a500dd8a93f8c2a9f0684cb4d10b30434e0bf4baa9da071282a2601687f0996d88064826e580692419977ce6d0918820449b530ee8c44848b28079f829
7
- data.tar.gz: fcb2534fbe4cdcb8c5f1b691b23aed6c56d427c90a4e5aa917865329f3e4eac4cc3e4c0356576ea68fd2d60c164a8ead9bdf0fa4fb45b7b460321aa645ebf0f0
6
+ metadata.gz: 9e6dea22f805c400a91b25becc5ce63e3859fb041ae7332ee66fae6d96b9779aa85b97a6369e7ae8cbe70e14a2a5aa747be3cfaf87cb9ec739b2444f60c11d2b
7
+ data.tar.gz: e32a2ae850e272742cb546a77dc6a06ac01decfb9240d1d397a67e406dd56bc85b603df686f2ddae6d7bf1869e2a8d2b367a5384e719f053b67fa9c8b0b09c89
@@ -0,0 +1,43 @@
1
+ module Katello
2
+ class Api::Rhsm::CandlepinDynflowProxyController < Api::V2::ApiController
3
+ include Katello::Authentication::ClientAuthentication
4
+ include ForemanTasks::Triggers
5
+ include AbstractController::Callbacks
6
+
7
+ skip_before_action :authorize, :only => [:upload_package_profile]
8
+ before_action :find_host, :only => [:upload_package_profile]
9
+ before_action :authorize_client_or_user, :only => [:upload_package_profile]
10
+
11
+ #api :PUT, "/consumers/:id/packages", N_("Update installed packages")
12
+ #api :PUT, "/consumers/:id/profile", N_("Update installed packages")
13
+ #param :id, String, :desc => N_("UUID of the consumer"), :required => true
14
+ def upload_package_profile
15
+ User.as_anonymous_admin do
16
+ async_task(::Actions::Katello::Host::UploadPackageProfile, @host, request.raw_post)
17
+ end
18
+ render :json => Resources::Candlepin::Consumer.get(@host.subscription_facet.uuid)
19
+ end
20
+
21
+ def find_host(uuid = nil)
22
+ params = request.path_parameters
23
+ uuid ||= params[:id]
24
+ facet = Katello::Host::SubscriptionFacet.where(:uuid => uuid).first
25
+ if facet.nil?
26
+ # check with candlepin if consumer is Gone, raises RestClient::Gone
27
+ User.as_anonymous_admin { Resources::Candlepin::Consumer.get(uuid) }
28
+ fail HttpErrors::NotFound, _("Couldn't find consumer '%s'") % uuid
29
+ end
30
+ @host = facet.host
31
+ end
32
+
33
+ def authorize_client_or_user
34
+ client_authorized? || authorize
35
+ end
36
+
37
+ def client_authorized?
38
+ authorized = authenticate_client && User.consumer?
39
+ authorized = (User.current.uuid == @host.subscription_facet.uuid) if @host && User.consumer?
40
+ authorized
41
+ end
42
+ end
43
+ end
@@ -11,8 +11,8 @@ module Katello
11
11
  :upload_package_profile, :regenerate_identity_certificates, :facts,
12
12
  :available_releases, :serials, :upload_tracer_profile]
13
13
  before_action :authorize, :only => [:consumer_create, :list_owners, :rhsm_index]
14
- before_action :authorize_client_or_user, :only => [:consumer_show, :upload_package_profile, :regenerate_identity_certificates, :upload_tracer_profile, :facts]
15
- before_action :authorize_client_or_admin, :only => [:hypervisors_update]
14
+ before_action :authorize_client_or_user, :only => [:consumer_show, :upload_package_profile, :regenerate_identity_certificates, :upload_tracer_profile, :facts, :proxy_jobs_get_path]
15
+ before_action :authorize_client_or_admin, :only => [:hypervisors_update, :async_hypervisors_update]
16
16
  before_action :authorize_proxy_routes, :only => [:get, :post, :put, :delete]
17
17
  before_action :authorize_client, :only => [:consumer_destroy, :consumer_checkin,
18
18
  :enabled_repos, :available_releases]
@@ -20,8 +20,10 @@ module Katello
20
20
  before_action :add_candlepin_version_header
21
21
 
22
22
  before_action :proxy_request_path, :proxy_request_body
23
- before_action :set_organization_id, :except => :hypervisors_update
24
- before_action :find_hypervisor_organization, :only => [:hypervisors_update]
23
+ before_action :set_organization_id, :except => [:hypervisors_update, :async_hypervisors_update]
24
+ before_action :find_hypervisor_organization, :only => [:async_hypervisors_update, :hypervisors_update]
25
+
26
+ before_action :check_content_type, :except => :async_hypervisors_update
25
27
 
26
28
  def repackage_message
27
29
  yield
@@ -108,6 +110,17 @@ module Katello
108
110
  respond_for_index :collection => @all_environments
109
111
  end
110
112
 
113
+ #api :POST, "/hypervisors/OWNER"
114
+ # Note that this request comes in as content-type 'text/plain' so that
115
+ # tomcat won't parse the json. Here we just pass the plain body through to candlepin
116
+ def async_hypervisors_update
117
+ raw_json = request.body.string
118
+ task = Katello::Resources::Candlepin::Consumer.async_hypervisors(params[:owner], raw_json)
119
+ async_task(::Actions::Katello::Host::Hypervisors, nil, :task_id => task['id'])
120
+
121
+ render :json => task
122
+ end
123
+
111
124
  #api :POST, "/hypervisors", N_("Update the hypervisors information for environment")
112
125
  #desc 'See virt-who tool for more details.'
113
126
  def hypervisors_update
@@ -128,16 +141,6 @@ module Katello
128
141
  render :json => Resources::Candlepin::Consumer.get(@host.subscription_facet.uuid)
129
142
  end
130
143
 
131
- #api :PUT, "/consumers/:id/packages", N_("Update installed packages")
132
- #api :PUT, "/consumers/:id/profile", N_("Update installed packages")
133
- #param :id, String, :desc => N_("UUID of the consumer"), :required => true
134
- def upload_package_profile
135
- User.as_anonymous_admin do
136
- async_task(::Actions::Katello::Host::UploadPackageProfile, @host, params[:_json])
137
- end
138
- render :json => Resources::Candlepin::Consumer.get(@host.subscription_facet.uuid)
139
- end
140
-
141
144
  api :PUT, "/consumers/:id/tracer", N_("Update services requiring restart")
142
145
  param :traces, Hash, :required => true
143
146
  def upload_tracer_profile
@@ -443,6 +446,7 @@ module Katello
443
446
  end
444
447
 
445
448
  # rubocop:disable MethodLength
449
+ # rubocop:disable Metrics/CyclomaticComplexity
446
450
  def authorize_proxy_routes
447
451
  deny_access unless (authenticate || authenticate_client)
448
452
 
@@ -486,6 +490,8 @@ module Katello
486
490
  User.consumer?
487
491
  when "rhsm_proxy_deleted_consumers_path"
488
492
  current_user.admin?
493
+ when "rhsm_proxy_jobs_get_path"
494
+ User.consumer? || current_user.admin?
489
495
  else
490
496
  Rails.logger.warn "Unknown proxy route #{request.method} #{request.fullpath}, access denied"
491
497
  deny_access
@@ -41,8 +41,8 @@ module Katello
41
41
  content_views = content_views.where(:organization_id => @organization.id) if @organization
42
42
  content_views = content_views.in_environment(@environment) if @environment
43
43
  content_views = content_views.non_default if params[:nondefault]
44
- content_views = content_views.non_composite if params[:noncomposite]
45
- content_views = content_views.composite if params[:composite]
44
+ content_views = ::Foreman::Cast.to_bool(params[:noncomposite]) ? content_views.non_composite : content_views.composite if params[:noncomposite]
45
+ content_views = ::Foreman::Cast.to_bool(params[:composite]) ? content_views.composite : content_views.non_composite if params[:composite]
46
46
  content_views = content_views.where(:name => params[:name]) if params[:name]
47
47
  content_views = content_views.where("#{ContentView.table_name}.id NOT IN (?)", params[:without]) if params[:without]
48
48
  content_views
@@ -37,6 +37,7 @@ module Katello
37
37
  def custom_index_relation(collection)
38
38
  collection = filter_by_cve(params[:cve], collection) if params[:cve]
39
39
  hosts = ::Host::Managed.authorized("view_hosts")
40
+ hosts = hosts.where(:organization_id => params[:organization_id]) if params[:organization_id]
40
41
  if ::Foreman::Cast.to_bool(params[:errata_restrict_applicable])
41
42
  collection = collection.applicable_to_hosts(hosts)
42
43
  end
@@ -45,13 +45,17 @@ module Katello
45
45
  if @host
46
46
  collection = collection.installable_for_hosts([@host])
47
47
  else
48
- collection = collection.installable_for_hosts(::Host::Managed.authorized("view_hosts"))
48
+ hosts = ::Host::Managed.authorized("view_hosts")
49
+ hosts = hosts.where(:organization_id => params[:organization_id]) if params[:organization_id]
50
+ collection = collection.installable_for_hosts(hosts)
49
51
  end
50
52
  elsif ::Foreman::Cast.to_bool(params[:packages_restrict_applicable]) || @host
51
53
  if @host
52
54
  collection = collection.applicable_to_hosts([@host])
53
55
  else
54
- collection = collection.applicable_to_hosts(::Host::Managed.authorized("view_hosts"))
56
+ hosts = ::Host::Managed.authorized("view_hosts")
57
+ hosts = hosts.where(:organization_id => params[:organization_id]) if params[:organization_id]
58
+ collection = collection.applicable_to_hosts(hosts)
55
59
  end
56
60
  end
57
61
 
@@ -0,0 +1,22 @@
1
+ module Actions
2
+ module Candlepin
3
+ class AsyncHypervisors < Candlepin::AbstractAsyncTask
4
+ # this action is for tracking an async candlepin task when the task id is already known
5
+ input_format do
6
+ param :task_id
7
+ end
8
+
9
+ def poll_external_task(task_id = external_task[:id])
10
+ task = ::Katello::Resources::Candlepin::Job.get(task_id, :result_data => true)
11
+ unless ::Katello::Resources::Candlepin::Job.not_finished?(task)
12
+ output[:hypervisors] = ::Actions::Katello::Host::Hypervisors.parse_hypervisors(task.delete('resultData'))
13
+ end
14
+ task
15
+ end
16
+
17
+ def invoke_external_task
18
+ poll_external_task(input[:task_id])
19
+ end
20
+ end
21
+ end
22
+ end
@@ -32,7 +32,7 @@ module Actions
32
32
  when /entitlement\.created/
33
33
  import_pool(wrapped_message.content['referenceId'])
34
34
  when /entitlement\.deleted/
35
- import_or_remove_pool(wrapped_message.content['referenceId'])
35
+ import_pool(wrapped_message.content['referenceId'])
36
36
  when /pool\.created/
37
37
  import_pool(wrapped_message.content['entityId'])
38
38
  when /pool\.deleted/
@@ -44,17 +44,13 @@ module Actions
44
44
 
45
45
  private
46
46
 
47
- def import_or_remove_pool(pool_id)
48
- pool = ::Katello::Pool.find_by(:cp_id => pool_id)
49
- pool.nil? ? remove_pool(pool_id) : pool.import_data
50
- rescue RestClient::ResourceNotFound
51
- remove_pool(pool_id)
52
- end
53
-
54
47
  def import_pool(pool_id)
55
- ::Katello::Pool.import_pool(pool_id)
56
- rescue RestClient::ResourceNotFound
57
- @logger.debug "skipped re-index of non-existent pool #{pool_id}"
48
+ pool = ::Katello::Pool.find_by(:cp_id => pool_id)
49
+ if pool
50
+ ::Katello::EventQueue.push_event(::Katello::Events::ImportPool::EVENT_TYPE, pool.id)
51
+ else
52
+ ::Katello::Pool.import_pool(pool_id)
53
+ end
58
54
  end
59
55
 
60
56
  def remove_pool(pool_id)
@@ -68,18 +64,18 @@ module Actions
68
64
 
69
65
  def reindex_consumer(message)
70
66
  if message.content['newEntity']
71
- uuid = JSON.parse(message.content['newEntity'])['consumer']['uuid']
72
- skip_msg = "skip re-indexing of non-existent content host #{uuid}"
73
- begin
74
- subscription_facet = ::Katello::Host::SubscriptionFacet.find_by_uuid(uuid)
75
- if subscription_facet.nil?
76
- @logger.debug "skip re-indexing of non-existent registered host #{uuid}"
77
- else
78
- @logger.debug "re-indexing content host #{subscription_facet.host.name}"
79
- subscription_facet.update_subscription_status
80
- end
81
- rescue RestClient::ResourceNotFound, RestClient::Gone
82
- @logger.debug(skip_msg)
67
+ parsed = JSON.parse(message.content['newEntity'])
68
+ uuid = parsed['consumer']['uuid']
69
+ sub_status = parsed['consumer']['entitlementStatus']
70
+ subscription_facet = ::Katello::Host::SubscriptionFacet.find_by_uuid(uuid)
71
+
72
+ if subscription_facet && sub_status
73
+ @logger.debug "re-indexing content host #{subscription_facet.host.name}"
74
+ subscription_facet.update_subscription_status(sub_status)
75
+ elsif subscription_facet.nil?
76
+ @logger.debug "skip re-indexing of non-existent content host #{uuid}"
77
+ elsif sub_status.nil?
78
+ @logger.debug "skip re-indexing of empty subscription status #{uuid}"
83
79
  end
84
80
  end
85
81
  end
@@ -12,6 +12,7 @@ module Actions
12
12
 
13
13
  def plan(capsule_content, options = {})
14
14
  capsule_content.ping_pulp
15
+ capsule_content.verify_ueber_certs
15
16
  action_subject(capsule_content.capsule)
16
17
 
17
18
  environment = options.fetch(:environment, nil)
@@ -2,14 +2,22 @@ module Actions
2
2
  module Katello
3
3
  module Host
4
4
  class Hypervisors < Actions::EntryAction
5
- def plan(hypervisor_params)
5
+ def plan(hypervisor_params, options = {})
6
+ task_id = options.fetch(:task_id, nil)
6
7
  sequence do
7
- hypervisor_results = ::Katello::Resources::Candlepin::Consumer.register_hypervisors(hypervisor_params)
8
- plan_action(Katello::Host::HypervisorsUpdate, parse_hypervisors(hypervisor_results))
8
+ if task_id
9
+ task_output = plan_action(Candlepin::AsyncHypervisors, :task_id => task_id).output
10
+ parsed_response = task_output[:hypervisors]
11
+ elsif hypervisor_params
12
+ hypervisor_results = ::Katello::Resources::Candlepin::Consumer.register_hypervisors(hypervisor_params)
13
+ parsed_response = Hypervisors.parse_hypervisors(hypervisor_results)
14
+ end
15
+ plan_self(:hypervisors => parsed_response)
16
+ plan_action(Katello::Host::HypervisorsUpdate, :hypervisors => parsed_response)
9
17
  end
10
18
  end
11
19
 
12
- def parse_hypervisors(hypervisor_results)
20
+ def self.parse_hypervisors(hypervisor_results)
13
21
  hypervisors = []
14
22
  %w(created updated unchanged).each do |group|
15
23
  if hypervisor_results[group]
@@ -24,6 +32,10 @@ module Actions
24
32
  end
25
33
  hypervisors
26
34
  end
35
+
36
+ def rescue_strategy
37
+ Dynflow::Action::Rescue::Skip
38
+ end
27
39
  end
28
40
  end
29
41
  end
@@ -4,8 +4,8 @@ module Actions
4
4
  class HypervisorsUpdate < Actions::EntryAction
5
5
  middleware.use ::Actions::Middleware::RemoteAction
6
6
 
7
- def plan(hypervisors)
8
- plan_self(:hypervisors => hypervisors)
7
+ input_format do
8
+ param :hypervisors
9
9
  end
10
10
 
11
11
  def run
@@ -4,14 +4,10 @@ module Actions
4
4
  class UploadPackageProfile < Actions::EntryAction
5
5
  middleware.use Actions::Middleware::KeepCurrentUser
6
6
 
7
- def plan(host, profile)
7
+ def plan(host, profile_string)
8
8
  action_subject host
9
9
 
10
- ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_package_profile(profile) if host.content_facet.uuid
11
- simple_packages = profile.map { |item| ::Katello::Pulp::SimplePackage.new(item) }
12
- host.import_package_profile(simple_packages)
13
-
14
- plan_self(:hostname => host.name)
10
+ plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
15
11
  plan_action(GenerateApplicability, [host])
16
12
  end
17
13
 
@@ -30,6 +26,17 @@ module Actions
30
26
  def rescue_strategy
31
27
  Dynflow::Action::Rescue::Skip
32
28
  end
29
+
30
+ def run
31
+ host = ::Host.find(input[:host_id])
32
+ profile = JSON.parse(input[:profile_string])
33
+ #free the huge string from the memory
34
+ input[:profile_string] = 'TRIMMED'.freeze
35
+
36
+ ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_package_profile(profile) if host.content_facet.uuid
37
+ simple_packages = profile.map { |item| ::Katello::Pulp::SimplePackage.new(item) }
38
+ host.import_package_profile(simple_packages)
39
+ end
33
40
  end
34
41
  end
35
42
  end
@@ -2,6 +2,8 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class RemoveContent < Actions::EntryAction
5
+ include Dynflow::Action::WithSubPlans
6
+
5
7
  middleware.use Actions::Middleware::KeepCurrentUser
6
8
 
7
9
  def plan(repository, content_units, options = {})
@@ -33,13 +35,16 @@ module Actions
33
35
  plan_action(pulp_action, :pulp_id => repository.pulp_id,
34
36
  :clauses => {:association => {'unit_id' => {'$in' => uuids}}
35
37
  })
36
-
37
- plan_self(:repository_id => repository.id, :user_id => ::User.current.id,
38
- sync_capsule: sync_capsule)
38
+ plan_self
39
39
  plan_action(CapsuleGenerateAndSync, repository) if sync_capsule
40
40
  end
41
41
  end
42
42
 
43
+ def create_sub_plans
44
+ trigger(Actions::Katello::Repository::MetadataGenerate,
45
+ ::Katello::Repository.find(input[:repository_id]))
46
+ end
47
+
43
48
  def resource_locks
44
49
  :link
45
50
  end
@@ -47,11 +52,6 @@ module Actions
47
52
  def humanized_name
48
53
  _("Remove Content")
49
54
  end
50
-
51
- def run
52
- output[:task_id] = ForemanTasks.sync_task(Actions::Katello::Repository::MetadataGenerate,
53
- ::Katello::Repository.find(input[:repository_id])).id
54
- end
55
55
  end
56
56
  end
57
57
  end
@@ -32,8 +32,8 @@ module Actions
32
32
 
33
33
  def source_action
34
34
  parent = self.action
35
- until parent.trigger.nil?
36
- parent = parent.trigger
35
+ until parent.triggering_action.nil?
36
+ parent = parent.triggering_action
37
37
  end
38
38
  parent
39
39
  end
@@ -147,6 +147,12 @@ module Katello
147
147
  raise ::Katello::Errors::CapsuleCannotBeReached, _("%s is unreachable. %s" % [@capsule.name, error])
148
148
  end
149
149
 
150
+ def verify_ueber_certs
151
+ self.capsule.organizations.each do |org|
152
+ Cert::Certs.verify_ueber_cert(org)
153
+ end
154
+ end
155
+
150
156
  def self.with_environment(environment, include_default = false)
151
157
  features = [SmartProxy::PULP_NODE_FEATURE]
152
158
  features << SmartProxy::PULP_FEATURE if include_default
@@ -117,6 +117,14 @@ module Katello
117
117
  JSON.parse(response).with_indifferent_access
118
118
  end
119
119
 
120
+ def async_hypervisors(owner, raw_json)
121
+ url = "/candlepin/hypervisors/#{owner}"
122
+ headers = self.default_headers
123
+ headers['content-type'] = 'text/plain'
124
+ response = self.post(url, raw_json, headers)
125
+ JSON.parse(response).with_indifferent_access
126
+ end
127
+
120
128
  def register_hypervisors(params)
121
129
  url = "/candlepin/hypervisors"
122
130
  url << "?owner=#{params[:owner]}&env=#{params[:env]}"
@@ -369,11 +377,8 @@ module Katello
369
377
 
370
378
  def import(organization_name, path_to_file, options)
371
379
  path = join_path(path(organization_name), 'imports')
372
-
373
- query_params = {}
374
- query_params[:force] = true if options[:force] == "true"
375
- unless query_params.empty?
376
- path << "?" << query_params.to_param
380
+ if options[:force] || SETTINGS[:katello].key?(:force_manifest_import)
381
+ path += "?force=#{SETTINGS[:katello][:force_manifest_import]}"
377
382
  end
378
383
 
379
384
  self.post(path, {:import => File.new(path_to_file, 'rb')}, self.default_headers.except('content-type'))
@@ -620,8 +625,8 @@ module Katello
620
625
  NOT_FINISHED_STATES.include?(job[:state])
621
626
  end
622
627
 
623
- def get(id)
624
- job_json = super(path(id), self.default_headers).body
628
+ def get(id, params = {})
629
+ job_json = super(path(id) + hash_to_query(params), self.default_headers).body
625
630
  job = JSON.parse(job_json)
626
631
  job.with_indifferent_access
627
632
  end