katello 3.4.2 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +1 -1
  3. data/app/controllers/katello/api/v2/api_controller.rb +10 -2
  4. data/app/controllers/katello/api/v2/capsule_content_controller.rb +1 -1
  5. data/app/controllers/katello/api/v2/docker_manifests_controller.rb +4 -0
  6. data/app/controllers/katello/api/v2/docker_tags_controller.rb +4 -5
  7. data/app/controllers/katello/api/v2/errata_controller.rb +3 -2
  8. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -1
  9. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +2 -2
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
  11. data/app/controllers/katello/application_controller.rb +9 -501
  12. data/app/controllers/katello/concerns/api/v2/repository_content_controller.rb +8 -10
  13. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +3 -3
  14. data/app/helpers/katello/layout_helper.rb +2 -0
  15. data/app/lib/actions/candlepin/consumer/update.rb +1 -0
  16. data/app/lib/actions/candlepin/import_pool_handler.rb +1 -1
  17. data/app/lib/actions/katello/capsule_content/remove_unneeded_repos.rb +1 -1
  18. data/app/lib/actions/katello/capsule_content/sync.rb +24 -14
  19. data/app/lib/actions/katello/content_view/capsule_generate_and_sync.rb +5 -4
  20. data/app/lib/actions/katello/content_view/errata_mail.rb +1 -1
  21. data/app/lib/actions/katello/content_view_puppet_environment/create.rb +3 -1
  22. data/app/lib/actions/katello/host/update.rb +18 -10
  23. data/app/lib/actions/katello/host/upload_package_profile.rb +4 -2
  24. data/app/lib/actions/katello/organization/manifest_refresh.rb +16 -9
  25. data/app/lib/actions/katello/repository/capsule_generate_and_sync.rb +5 -3
  26. data/app/lib/actions/katello/repository/errata_mail.rb +1 -1
  27. data/app/lib/actions/katello/repository/refresh_repository.rb +3 -3
  28. data/app/lib/actions/pulp/abstract_async_task_group.rb +18 -0
  29. data/app/lib/actions/pulp/consumer/sync_capsule.rb +2 -1
  30. data/app/lib/katello/resources/candlepin.rb +9 -6
  31. data/app/lib/katello/util/support.rb +1 -1
  32. data/app/models/katello/authorization/repository.rb +3 -3
  33. data/app/models/katello/concerns/operatingsystem_extensions.rb +2 -2
  34. data/app/models/katello/concerns/pulp_database_unit.rb +1 -1
  35. data/app/models/katello/docker_manifest.rb +5 -1
  36. data/app/models/katello/docker_meta_tag.rb +108 -0
  37. data/app/models/katello/docker_tag.rb +19 -1
  38. data/app/models/katello/erratum.rb +16 -6
  39. data/app/models/katello/glue/candlepin/candlepin_object.rb +12 -11
  40. data/app/models/katello/glue/candlepin/subscription.rb +3 -1
  41. data/app/models/katello/glue/provider.rb +4 -4
  42. data/app/models/katello/glue/pulp/repo.rb +25 -0
  43. data/app/models/katello/host/content_facet.rb +1 -1
  44. data/app/models/katello/host/subscription_facet.rb +1 -1
  45. data/app/models/katello/pool.rb +1 -1
  46. data/app/models/katello/repository.rb +8 -0
  47. data/app/models/katello/sync_plan.rb +2 -2
  48. data/app/models/setting/content.rb +1 -0
  49. data/app/overrides/add_about_page.rb +0 -7
  50. data/app/views/common/400.html +9 -0
  51. data/app/views/katello/api/v2/content_views/base.json.rabl +1 -1
  52. data/app/views/katello/api/v2/docker_tags/_base.json.rabl +11 -1
  53. data/app/views/katello/api/v2/repositories/base.json.rabl +1 -1
  54. data/config/routes/api/rhsm.rb +1 -0
  55. data/db/migrate/20170523182831_create_docker_meta_tag.rb +13 -0
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-host-modal-helper.service.js +71 -0
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.controller.js +13 -56
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts.routes.js +1 -1
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-details-info.controller.js +6 -4
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/views/content-host-info.html +2 -2
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/content-views.routes.js +9 -0
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-views/details/views/content-view-copy.html +3 -1
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/details/views/docker-tag-info.html +27 -16
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/docker-tags.controller.js +12 -0
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/docker-tags/views/docker-tags.html +4 -0
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/details/erratum-content-hosts.controller.js +10 -4
  67. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/errata/errata.controller.js +1 -1
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/host-collection-details.controller.js +41 -6
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/host-collections/details/views/host-collection-info.html +11 -5
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-manage-docker-manifests.html +4 -0
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/discovery/discovery-create.controller.js +9 -11
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/subscription-content-hosts.controller.js +4 -0
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-content-hosts.html +1 -1
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/manifest-import.controller.js +26 -20
  75. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/manifest/views/manifest-import.html +16 -12
  76. data/lib/katello/tasks/delete_orphaned_content.rake +8 -1
  77. data/lib/katello/tasks/repository.rake +20 -0
  78. data/lib/katello/version.rb +1 -1
  79. metadata +6 -6
  80. data/app/controllers/katello/errors_controller.rb +0 -23
  81. data/app/controllers/katello/failed_authentication_controller.rb +0 -51
  82. data/app/controllers/katello/sort_column_list.rb +0 -19
  83. data/app/views/overrides/about/_support_documentation.html.erb +0 -7
@@ -38,7 +38,7 @@ module Katello
38
38
  fail "Unsupported default_sort type"
39
39
  end
40
40
 
41
- respond(:collection => scoped_search(index_relation.uniq, sort_options[0], sort_options[1], options))
41
+ respond(:collection => scoped_search(index_relation, sort_options[0], sort_options[1], options))
42
42
  end
43
43
 
44
44
  api :GET, "/:resource_id/:id", N_("Show :a_resource")
@@ -74,17 +74,19 @@ module Katello
74
74
  param :filterId, :integer, :desc => N_("Content View Filter id")
75
75
  def index_relation
76
76
  collection = resource_class.all
77
- collection = filter_by_repos(Repository.readable, collection)
78
- collection = filter_by_repos([@repo], collection) if @repo
79
- collection = filter_by_content_view_version(@version, collection) if @version
77
+ repos = Repository.readable
78
+ repos = repos.where(:id => @repo) if @repo
79
+ repos = repos.where(:id => Repository.readable.in_organization(@organization)) if @organization
80
80
  if @environment && (@environment.library? || resource_class != Katello::PuppetModule)
81
81
  # if the environment is not library and this is for puppet modules,
82
82
  # we can skip environment filter, as those would be associated to
83
83
  # content view puppet environments and handled by the puppet modules
84
84
  # controller.
85
- collection = filter_by_environment(@environment, collection)
85
+ repos = repos.where(:id => @environment.repositories)
86
86
  end
87
- collection = filter_by_repos(Repository.readable.in_organization(@organization), collection) if @organization
87
+
88
+ collection = filter_by_repos(repos, collection)
89
+ collection = filter_by_content_view_version(@version, collection) if @version
88
90
  collection = filter_by_ids(params[:ids], collection) if params[:ids]
89
91
  @filter = ContentViewFilter.find(params[:filterId]) if params[:filterId]
90
92
  if params[:available_for] == "content_view_filter" && self.respond_to?(:available_for_content_view_filter)
@@ -115,10 +117,6 @@ module Katello
115
117
  collection.where(:id => version.send(controller_name))
116
118
  end
117
119
 
118
- def filter_by_environment(environment, collection)
119
- filter_by_repos(environment.repositories, collection)
120
- end
121
-
122
120
  def find_content_resource
123
121
  @resource = resource_class.with_identifiers(params[:id]).first
124
122
 
@@ -198,9 +198,9 @@ module Katello
198
198
  new_host.architecture = param_host.architecture.present? ? param_host.architecture : host.architecture
199
199
 
200
200
  if (host.is_a? Hostgroup)
201
- new_host.content_facet = ::Katello::Host::ContentFacet.new(:lifecycle_environment_id => host.lifecycle_environment_id,
202
- :content_view_id => host.content_view_id,
203
- :content_source_id => host.content_source_id)
201
+ new_host.content_facet = ::Katello::Host::ContentFacet.new(:lifecycle_environment_id => host.inherited_lifecycle_environment_id,
202
+ :content_view_id => host.inherited_content_view_id,
203
+ :content_source_id => host.inherited_content_source_id)
204
204
  elsif host.content_facet.present?
205
205
  new_host.content_facet = ::Katello::Host::ContentFacet.new(:lifecycle_environment_id => host.content_facet.lifecycle_environment_id,
206
206
  :content_view_id => host.content_facet.content_view_id,
@@ -1,5 +1,7 @@
1
1
  module Katello
2
2
  module LayoutHelper
3
+ include ::LayoutHelper
4
+
3
5
  def stylesheet(*args)
4
6
  args.map { |arg| content_for(:stylesheets) { stylesheet_link_tag(arg) } }
5
7
  return ""
@@ -9,6 +9,7 @@ module Actions
9
9
 
10
10
  def run
11
11
  ::Katello::Resources::Candlepin::Consumer.update(input[:uuid], input[:consumer_params])
12
+ output[:uuid] = input[:uuid]
12
13
  end
13
14
 
14
15
  def finalize
@@ -66,7 +66,7 @@ module Actions
66
66
  if message.content['newEntity']
67
67
  parsed = JSON.parse(message.content['newEntity'])
68
68
  uuid = parsed['consumer']['uuid']
69
- sub_status = parsed['consumer']['entitlementStatus']
69
+ sub_status = parsed['status']['status']
70
70
  subscription_facet = ::Katello::Host::SubscriptionFacet.find_by_uuid(uuid)
71
71
 
72
72
  if subscription_facet && sub_status
@@ -8,7 +8,7 @@ module Actions
8
8
 
9
9
  need_removal = currently_on_capsule - needed_on_capsule
10
10
  need_removal += capsule_content.orphaned_repos
11
- need_removal.each do |pulp_id|
11
+ need_removal.compact.each do |pulp_id|
12
12
  plan_action(Pulp::Repository::Destroy,
13
13
  :pulp_id => pulp_id,
14
14
  :capsule_id => capsule_content.capsule.id)
@@ -6,18 +6,30 @@ module Actions
6
6
  :link
7
7
  end
8
8
 
9
+ input_format do
10
+ param :name
11
+ end
12
+
9
13
  def humanized_name
10
- _("Synchronize capsule content")
14
+ _("Synchronize smart proxy")
11
15
  end
12
16
 
13
- def plan(capsule_content, options = {})
17
+ def humanized_input
18
+ ["'#{input['smart_proxy']['name']}'"] + super
19
+ end
20
+
21
+ def plan(smart_proxy, options = {})
22
+ action_subject(smart_proxy)
23
+ capsule_content = ::Katello::CapsuleContent.new(smart_proxy)
14
24
  capsule_content.ping_pulp
15
25
  capsule_content.verify_ueber_certs
16
- action_subject(capsule_content.capsule)
17
26
 
18
- environment = options.fetch(:environment, nil)
19
- repository = options.fetch(:repository, nil)
20
- content_view = options.fetch(:content_view, nil)
27
+ environment_id = options.fetch(:environment_id, nil)
28
+ environment = ::Katello::KTEnvironment.find(environment_id) if environment_id
29
+ repository_id = options.fetch(:repository_id, nil)
30
+ repository = ::Katello::Repository.find(repository_id) if repository_id
31
+ content_view_id = options.fetch(:content_view_id, nil)
32
+ content_view = ::Katello::ContentView.find(content_view_id) if content_view_id
21
33
 
22
34
  fail _("Action not allowed for the default capsule.") if capsule_content.default_capsule?
23
35
 
@@ -31,7 +43,6 @@ module Actions
31
43
  end
32
44
  plan_action(ConfigureCapsule, capsule_content, environment, content_view, repository)
33
45
  sync_repos_to_capsule(capsule_content, repository_ids)
34
- plan_action(RemoveOrphans, :capsule_id => capsule_content.capsule.id)
35
46
  end
36
47
  end
37
48
  end
@@ -40,19 +51,18 @@ module Actions
40
51
  concurrence do
41
52
  repository_ids.each do |repo_id|
42
53
  sequence do
43
- repo = ::Katello::Repository.where(:pulp_id => repo_id).first ||
44
- ::Katello::ContentViewPuppetEnvironment.where(:pulp_id => repo_id).first
45
- if repo && repo.content_type != "yum"
46
- # we unassociate units in non-yum repos in order to avoid version conflicts
47
- # during publish. (i.e. two versions of a puppet module in the same repo)
54
+ repo = ::Katello::Repository.find_by(pulp_id: repo_id)
55
+ if repo && ['yum', 'puppet'].exclude?(repo.content_type)
56
+ # we unassociate units in non-yum/puppet repos in order to avoid version conflicts
57
+ # during publish. (i.e. two versions of a unit in the same repo)
48
58
  plan_action(Pulp::Consumer::UnassociateUnits,
49
59
  capsule_id: capsule_content.capsule.id,
50
60
  repo_pulp_id: repo_id)
51
61
  end
52
-
53
62
  plan_action(Pulp::Consumer::SyncCapsule,
54
63
  capsule_id: capsule_content.capsule.id,
55
- repo_pulp_id: repo_id)
64
+ repo_pulp_id: repo_id,
65
+ sync_options: { remove_missing: repo && ["puppet", "yum"].include?(repo.content_type) })
56
66
  end
57
67
  end
58
68
  end
@@ -3,15 +3,16 @@ module Actions
3
3
  module ContentView
4
4
  class CapsuleGenerateAndSync < Actions::Base
5
5
  def humanized_name
6
- _("Sync Smart proxy with Content View")
6
+ _("Sync Content View on Smart Proxy(ies)")
7
7
  end
8
8
 
9
9
  def plan(content_view, environment)
10
10
  sequence do
11
11
  concurrence do
12
- ::Katello::CapsuleContent.with_environment(environment).each do |capsule_content|
13
- plan_action(Katello::CapsuleContent::Sync, capsule_content, :content_view => content_view,
14
- :environment => environment)
12
+ smart_proxies = ::Katello::CapsuleContent.with_environment(environment).map { |capsule| capsule.capsule }
13
+ unless smart_proxies.blank?
14
+ plan_action(::Actions::BulkAction, ::Actions::Katello::CapsuleContent::Sync, smart_proxies,
15
+ :content_view_id => content_view.id, :environment_id => environment.id)
15
16
  end
16
17
  end
17
18
  end
@@ -11,7 +11,7 @@ module Actions
11
11
 
12
12
  content_view = ::Katello::ContentView.find(input[:content_view])
13
13
  environment = ::Katello::KTEnvironment.find(input[:environment])
14
- users = ::User.select { |user| user.receives?(:promote_errata) && user.can?(:view_content_views, content_view) }
14
+ users = ::User.select { |user| user.receives?(:promote_errata) && user.organization_ids.include?(content_view.organization_id) && user.can?(:view_content_views, content_view) }
15
15
 
16
16
  begin
17
17
  MailNotification[:promote_errata].deliver_now(:users => users, :content_view => content_view, :environment => environment) unless users.blank?
@@ -5,7 +5,9 @@ module Actions
5
5
  def plan(puppet_environment, clone = false)
6
6
  internal_capsule = SmartProxy.default_capsule
7
7
  fail _("Content View %s cannot be published without an internal capsule." % puppet_environment.name) unless internal_capsule
8
- puppet_environment.save!
8
+
9
+ User.as_anonymous_admin { puppet_environment.save! }
10
+
9
11
  action_subject(puppet_environment)
10
12
  plan_self
11
13
 
@@ -6,8 +6,6 @@ module Actions
6
6
 
7
7
  def plan(host, consumer_params = nil)
8
8
  action_subject host
9
- plan_self(:hostname => host.name, :facts => consumer_params.try(:[], :facts), :host_id => host.id)
10
-
11
9
  sequence do
12
10
  host.content_facet.save! if host.content_facet
13
11
 
@@ -15,24 +13,34 @@ module Actions
15
13
  unless consumer_params
16
14
  consumer_params = host.subscription_facet.consumer_attributes
17
15
  end
18
-
19
- host.subscription_facet.update_from_consumer_attributes(consumer_params)
20
- host.subscription_facet.save!
21
- plan_action(::Actions::Candlepin::Consumer::Update, host.subscription_facet.uuid, consumer_params)
16
+ cp_update = plan_action(::Actions::Candlepin::Consumer::Update, host.subscription_facet.uuid, consumer_params)
22
17
  end
23
18
 
24
- if host.subscription_facet.try(:autoheal)
19
+ if consumer_params.present? && consumer_params['autoheal']
25
20
  plan_action(::Actions::Candlepin::Consumer::AutoAttachSubscriptions, :uuid => host.subscription_facet.uuid)
26
21
  end
22
+
23
+ plan_self(:hostname => host.name, :consumer_params => consumer_params, :host_id => host.id,
24
+ :dependency => cp_update.try(:output))
27
25
  end
28
26
  end
29
27
 
30
28
  def run
31
29
  User.as_anonymous_admin do
32
30
  host = ::Host.find(input[:host_id])
33
- unless input[:facts].blank?
34
- ::Katello::Host::SubscriptionFacet.update_facts(host, input[:facts])
35
- input[:facts] = 'TRIMMED'
31
+ unless input[:consumer_params][:facts].blank?
32
+ ::Katello::Host::SubscriptionFacet.update_facts(host, input[:consumer_params][:facts])
33
+ end
34
+ end
35
+ end
36
+
37
+ def finalize
38
+ User.as_anonymous_admin do
39
+ unless input[:consumer_params].blank?
40
+ host = ::Host.find(input[:host_id])
41
+ host.subscription_facet.update_from_consumer_attributes(input[:consumer_params])
42
+ host.subscription_facet.save!
43
+ input[:consumer_params][:facts] = 'TRIMMED' unless input[:consumer_params][:facts].blank?
36
44
  end
37
45
  end
38
46
  end
@@ -7,8 +7,10 @@ module Actions
7
7
  def plan(host, profile_string)
8
8
  action_subject host
9
9
 
10
- plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
11
- plan_action(GenerateApplicability, [host])
10
+ sequence do
11
+ plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
12
+ plan_action(GenerateApplicability, [host])
13
+ end
12
14
  end
13
15
 
14
16
  def humanized_name
@@ -12,29 +12,36 @@ module Actions
12
12
  upstream = details['upstreamConsumer'].blank? ? {} : details['upstreamConsumer']
13
13
 
14
14
  sequence do
15
- plan_action(Candlepin::Owner::UpstreamRegenerateCertificates,
15
+ regen_certs = plan_action(Candlepin::Owner::UpstreamRegenerateCertificates,
16
16
  :organization_id => organization.id,
17
17
  :upstream => upstream)
18
- plan_action(Candlepin::Owner::UpstreamUpdate,
18
+ upstream_update = plan_action(Candlepin::Owner::UpstreamUpdate,
19
19
  :organization_id => organization.id,
20
- :upstream => upstream)
21
- plan_action(Candlepin::Owner::UpstreamExport,
20
+ :upstream => upstream,
21
+ :dependency => regen_certs.output)
22
+ export_action = plan_action(Candlepin::Owner::UpstreamExport,
22
23
  :organization_id => organization.id,
23
24
  :upstream => upstream,
24
- :path => path)
25
- plan_action(Candlepin::Owner::Import,
25
+ :path => path,
26
+ :dependency => upstream_update.output)
27
+ owner_import = plan_action(Candlepin::Owner::Import,
26
28
  :label => organization.label,
27
- :path => path)
28
- plan_action(Candlepin::Owner::ImportProducts, :organization_id => organization.id)
29
+ :path => path,
30
+ :dependency => export_action.output)
31
+ import_products = plan_action(Candlepin::Owner::ImportProducts, :organization_id => organization.id, :dependency => owner_import.output)
29
32
 
30
33
  if manifest_update && SETTINGS[:katello][:use_pulp]
31
34
  organization.products.redhat.flat_map(&:repositories).each do |repo|
32
- plan_action(Katello::Repository::RefreshRepository, repo)
35
+ plan_action(Katello::Repository::RefreshRepository, repo, :dependency => import_products.output)
33
36
  end
34
37
  end
35
38
  end
36
39
  end
37
40
 
41
+ def rescue_strategy
42
+ Dynflow::Action::Rescue::Skip
43
+ end
44
+
38
45
  def humanized_name
39
46
  _("Refresh Manifest")
40
47
  end
@@ -3,14 +3,16 @@ module Actions
3
3
  module Repository
4
4
  class CapsuleGenerateAndSync < Actions::Base
5
5
  def humanized_name
6
- _("Sync Repository on Smart proxy(ies)")
6
+ _("Sync Repository on Smart Proxy(ies)")
7
7
  end
8
8
 
9
9
  def plan(repo)
10
10
  if repo.node_syncable?
11
11
  concurrence do
12
- ::Katello::CapsuleContent.with_environment(repo.environment).each do |capsule_content|
13
- plan_action(Katello::CapsuleContent::Sync, capsule_content, repository: repo)
12
+ smart_proxies = ::Katello::CapsuleContent.with_environment(repo.environment).map { |c| c.capsule }
13
+ unless smart_proxies.blank?
14
+ plan_action(::Actions::BulkAction, ::Actions::Katello::CapsuleContent::Sync, smart_proxies,
15
+ :repository_id => repo.id)
14
16
  end
15
17
  end
16
18
  end
@@ -13,7 +13,7 @@ module Actions
13
13
  ::User.current = ::User.anonymous_admin
14
14
 
15
15
  repo = ::Katello::Repository.find(input[:repo])
16
- users = ::User.select { |user| user.receives?(:sync_errata) && user.can?(:view_products, repo.product) }.compact
16
+ users = ::User.select { |user| user.receives?(:sync_errata) && user.organization_ids.include?(repo.organization.id) && user.can?(:view_products, repo.product) }.compact
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
@@ -2,11 +2,11 @@ module Actions
2
2
  module Katello
3
3
  module Repository
4
4
  class RefreshRepository < Actions::Base
5
- def plan(repo)
5
+ def plan(repo, options = {})
6
6
  User.as_anonymous_admin do
7
7
  repo = ::Katello::Repository.find(repo.id)
8
- plan_action(Pulp::Repository::Refresh, repo, :capsule_id => SmartProxy.default_capsule!.id)
9
- plan_self(:name => repo.name)
8
+ plan_action(Pulp::Repository::Refresh, repo, :capsule_id => SmartProxy.default_capsule!.id, :dependency => options[:dependency])
9
+ plan_self(:name => repo.name, :dependency => options[:dependency])
10
10
  end
11
11
  end
12
12
  end
@@ -2,6 +2,7 @@ module Actions
2
2
  module Pulp
3
3
  class AbstractAsyncTaskGroup < Pulp::Abstract
4
4
  include Actions::Base::Polling
5
+ include ::Dynflow::Action::Cancellable
5
6
 
6
7
  # A call report (documented https://github.com/pulp/pulp/blob/master/docs/dev-guide/integration/rest-api/consumer/applicability.rst#id65)
7
8
  # Looks like:
@@ -31,6 +32,23 @@ module Actions
31
32
  end
32
33
  end
33
34
 
35
+ def cancel!
36
+ cancel
37
+ self.external_task = poll_external_task
38
+ # We suspend the action and the polling will take care of finding
39
+ # out if the cancelling was successful
40
+ suspend unless done?
41
+ end
42
+
43
+ def cancel
44
+ group = output['pulp_task_group']
45
+ if group
46
+ task_resource.cancel(group['id'])
47
+ end
48
+ rescue RestClient::ResourceNotFound
49
+ nil #Pulp throws a 404 if there are no tasks in the task group https://pulp.plan.io/issues/2943
50
+ end
51
+
34
52
  def humanized_state
35
53
  case state
36
54
  when :running
@@ -5,6 +5,7 @@ module Actions
5
5
  input_format do
6
6
  param :capsule_id, Integer
7
7
  param :repo_pulp_id, String
8
+ param :sync_options
8
9
  end
9
10
 
10
11
  def humanized_name
@@ -12,7 +13,7 @@ module Actions
12
13
  end
13
14
 
14
15
  def invoke_external_task
15
- pulp_resources.repository.sync(input[:repo_pulp_id])
16
+ pulp_resources.repository.sync(input[:repo_pulp_id], override_config: input[:sync_options])
16
17
  end
17
18
 
18
19
  def run_progress
@@ -295,9 +295,9 @@ module Katello
295
295
 
296
296
  uri.scheme = URI.parse(proxy_config[:host]).scheme
297
297
  uri.host = URI.parse(proxy_config[:host]).host
298
- uri.port = proxy_config[:port].to_s
299
- uri.user = proxy_config[:user].to_s
300
- uri.password = proxy_config[:password].to_s
298
+ uri.port = proxy_config[:port].try(:to_s)
299
+ uri.user = proxy_config[:user].try(:to_s)
300
+ uri.password = proxy_config[:password].try(:to_s)
301
301
 
302
302
  RestClient.proxy = uri.to_s
303
303
  end
@@ -306,7 +306,9 @@ module Katello
306
306
  :ssl_client_cert => OpenSSL::X509::Certificate.new(client_cert),
307
307
  :ssl_client_key => OpenSSL::PKey::RSA.new(client_key),
308
308
  :ssl_ca_file => ca_file,
309
- :verify_ssl => ca_file ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
309
+ :verify_ssl => ca_file ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE,
310
+ :open_timeout => Setting[:manifest_refresh_timeout],
311
+ :timeout => Setting[:manifest_refresh_timeout]
310
312
  )
311
313
  end
312
314
 
@@ -673,9 +675,10 @@ module Katello
673
675
  subscriptions = JSON.parse(subscriptions_json)
674
676
 
675
677
  product_subscription = subscriptions.find do |sub|
676
- sub["product"]["id"] == id ||
678
+ sub['certificate'] &&
679
+ (sub["product"]["id"] == id ||
677
680
  sub["providedProducts"].any? { |provided| provided["id"] == id } ||
678
- sub["derivedProvidedProducts"].any? { |provided| provided["id"] == id }
681
+ sub["derivedProvidedProducts"].any? { |provided| provided["id"] == id })
679
682
  end
680
683
 
681
684
  if product_subscription