katello 4.1.0.rc2.2 → 4.1.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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/katello/api/v2/content_export_incrementals_controller.rb +1 -1
  3. data/app/controllers/katello/api/v2/content_exports_controller.rb +1 -1
  4. data/app/controllers/katello/api/v2/content_imports_controller.rb +2 -2
  5. data/app/controllers/katello/api/v2/errata_controller.rb +2 -23
  6. data/app/controllers/katello/api/v2/host_errata_controller.rb +5 -32
  7. data/app/controllers/katello/api/v2/host_packages_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/hosts_bulk_actions_controller.rb +1 -1
  9. data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +0 -1
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
  11. data/app/controllers/katello/concerns/api/v2/host_errata_extensions.rb +41 -0
  12. data/app/controllers/katello/remote_execution_controller.rb +5 -9
  13. data/app/lib/actions/candlepin/abstract_async_task.rb +9 -1
  14. data/app/lib/actions/katello/agent_action.rb +2 -0
  15. data/app/lib/actions/katello/applicability/repository/regenerate.rb +10 -10
  16. data/app/lib/actions/katello/capsule_content/sync.rb +1 -1
  17. data/app/lib/actions/katello/host/upload_package_profile.rb +1 -6
  18. data/app/lib/actions/katello/host/upload_profiles.rb +2 -41
  19. data/app/lib/actions/katello/orphan_cleanup/remove_orphans.rb +2 -2
  20. data/app/lib/actions/katello/repository/check_matching_content.rb +13 -14
  21. data/app/lib/actions/katello/repository/sync.rb +3 -14
  22. data/app/lib/actions/katello/repository/verify_checksum.rb +1 -1
  23. data/app/lib/actions/katello/sync_plan/run.rb +7 -2
  24. data/app/lib/actions/pulp3/content_guard/refresh.rb +6 -10
  25. data/app/lib/actions/pulp3/orchestration/orphan_cleanup/remove_orphans.rb +1 -1
  26. data/app/lib/actions/pulp3/repository/save_version.rb +1 -0
  27. data/app/lib/katello/errors.rb +1 -1
  28. data/app/lib/katello/event_daemon/monitor.rb +1 -0
  29. data/app/lib/katello/event_daemon/services/agent_event_receiver.rb +6 -10
  30. data/app/lib/katello/util/hostgroup_facets_helper.rb +126 -0
  31. data/app/models/katello/authorization/content_view.rb +5 -9
  32. data/app/models/katello/authorization/organization.rb +4 -4
  33. data/app/models/katello/concerns/hostgroup_extensions.rb +3 -1
  34. data/app/models/katello/concerns/pulp_database_unit.rb +42 -0
  35. data/app/models/katello/concerns/redhat_extensions.rb +18 -10
  36. data/app/models/katello/erratum.rb +0 -4
  37. data/app/models/katello/glue/pulp/repo.rb +0 -19
  38. data/app/models/katello/host/content_facet.rb +11 -20
  39. data/app/models/katello/host_available_module_stream.rb +4 -4
  40. data/app/models/katello/module_stream.rb +0 -4
  41. data/app/models/katello/ping.rb +2 -9
  42. data/app/models/katello/repository.rb +14 -4
  43. data/app/models/katello/root_repository.rb +4 -0
  44. data/app/models/katello/rpm.rb +0 -4
  45. data/app/services/cert/certs.rb +4 -0
  46. data/app/services/katello/applicable_host_queue.rb +2 -2
  47. data/app/services/katello/pulp/yum_metadata_file.rb +6 -2
  48. data/app/services/katello/pulp3/api/content_guard.rb +39 -5
  49. data/app/services/katello/pulp3/repository/ansible_collection.rb +1 -1
  50. data/app/services/katello/pulp3/repository/yum.rb +1 -0
  51. data/app/services/katello/registration_manager.rb +4 -24
  52. data/app/services/katello/ui_notifications/pulp/proxy_disk_space.rb +1 -0
  53. data/app/views/katello/api/v2/repository_sets/show.json.rabl +9 -5
  54. data/config/katello.yaml.example +0 -13
  55. data/config/routes/api/v2.rb +0 -1
  56. data/db/migrate/20200514092553_move_katello_fields_from_hostgroups.katello.rb +15 -1
  57. data/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb +18 -22
  58. data/db/migrate/20210512170039_add_repo_timestamps.rb +6 -0
  59. data/db/migrate/20210512192745_fix_red_hat_root_repository_arch.rb +11 -0
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-errata-modal.controller.js +26 -27
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-module-streams-modal.controller.js +1 -3
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/content-hosts-bulk-packages-modal.controller.js +1 -5
  63. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-host-bulk-module-streams-modal.html +1 -1
  64. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-errata-modal.html +2 -2
  65. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/bulk/views/content-hosts-bulk-packages-modal.html +7 -2
  66. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-errata.controller.js +5 -2
  67. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-module-streams.controller.js +1 -1
  68. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/content-host-packages.controller.js +1 -1
  69. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-errata.html +2 -2
  70. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-module-streams.html +1 -1
  71. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages-actions.html +7 -2
  72. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content/views/content-host-packages.html +2 -2
  73. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/i18n/bastion_katello.pot +5 -10
  74. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/new/new-repository.controller.js +3 -5
  75. data/lib/katello.rb +1 -1
  76. data/lib/katello/engine.rb +0 -2
  77. data/lib/katello/permission_creator.rb +7 -14
  78. data/lib/katello/plugin.rb +9 -0
  79. data/lib/katello/tasks/fix_hostgroup_facets.rake +8 -0
  80. data/lib/katello/tasks/upgrades/4.1/update_content_import_export_perms.rake +33 -0
  81. data/lib/katello/version.rb +1 -1
  82. data/locale/action_names.rb +39 -39
  83. data/locale/bn/katello.edit.po +114 -107
  84. data/locale/bn/katello.po +12 -6
  85. data/locale/cs/katello.edit.po +118 -115
  86. data/locale/cs/katello.po +12 -6
  87. data/locale/de/katello.edit.po +126 -136
  88. data/locale/de/katello.po +12 -6
  89. data/locale/en/katello.edit.po +114 -106
  90. data/locale/en/katello.po +12 -6
  91. data/locale/es/katello.edit.po +129 -165
  92. data/locale/es/katello.po +12 -6
  93. data/locale/fr/katello.edit.po +143 -247
  94. data/locale/fr/katello.po +13 -9
  95. data/locale/gu/katello.edit.po +114 -107
  96. data/locale/gu/katello.po +12 -6
  97. data/locale/hi/katello.edit.po +114 -107
  98. data/locale/hi/katello.po +12 -6
  99. data/locale/it/katello.edit.po +121 -131
  100. data/locale/it/katello.po +12 -6
  101. data/locale/ja/katello.edit.po +141 -229
  102. data/locale/ja/katello.po +13 -9
  103. data/locale/katello.pot +124 -114
  104. data/locale/kn/katello.edit.po +114 -107
  105. data/locale/kn/katello.po +12 -6
  106. data/locale/ko/katello.edit.po +126 -136
  107. data/locale/ko/katello.po +12 -6
  108. data/locale/mr/katello.edit.po +114 -107
  109. data/locale/mr/katello.po +12 -6
  110. data/locale/or/katello.edit.po +114 -107
  111. data/locale/or/katello.po +12 -6
  112. data/locale/pa/katello.edit.po +114 -107
  113. data/locale/pa/katello.po +12 -6
  114. data/locale/pt/katello.edit.po +114 -107
  115. data/locale/pt/katello.po +12 -6
  116. data/locale/pt_BR/katello.edit.po +129 -165
  117. data/locale/pt_BR/katello.po +12 -6
  118. data/locale/ru/katello.edit.po +126 -136
  119. data/locale/ru/katello.po +12 -6
  120. data/locale/ta/katello.edit.po +114 -107
  121. data/locale/ta/katello.po +12 -6
  122. data/locale/te/katello.edit.po +114 -107
  123. data/locale/te/katello.po +12 -6
  124. data/locale/zh_CN/katello.edit.po +140 -229
  125. data/locale/zh_CN/katello.po +13 -9
  126. data/locale/zh_TW/katello.edit.po +127 -153
  127. data/locale/zh_TW/katello.po +12 -6
  128. data/webpack/components/react-bootstrap-select/index.js +1 -1
  129. metadata +26 -18
  130. data/app/lib/actions/katello/host/generate_applicability.rb +0 -41
  131. data/app/lib/actions/katello/repository/import_applicability.rb +0 -25
  132. data/app/lib/actions/pulp/consumer.rb +0 -100
  133. data/app/lib/actions/pulp/consumer/create.rb +0 -19
  134. data/app/lib/actions/pulp/consumer/destroy.rb +0 -17
  135. data/app/lib/actions/pulp/consumer/generate_applicability.rb +0 -24
  136. data/app/lib/actions/pulp/consumer/update.rb +0 -20
  137. data/app/lib/actions/pulp3/capsule_content/refresh_content_guard.rb +0 -17
  138. data/app/models/katello/events/import_host_applicability.rb +0 -16
  139. data/app/services/katello/applicable_content_helper.rb +0 -111
  140. data/app/services/katello/pulp/consumer.rb +0 -83
  141. data/app/services/katello/pulp/consumer_group.rb +0 -95
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b5fdc201af935cf74af29ff64e8b4ac30918984308a428615d4297780bf714e
4
- data.tar.gz: df90a5fee570cae2ff2a3b9978fa91062a3d6dc8b1b704460780d6ef4141cc7a
3
+ metadata.gz: f30d037b42e387abe07cb200218782b7918735e7ae3e6eff511491914e7dc4e3
4
+ data.tar.gz: f92e5533113942c7f23d579f53dbe1474bbf68970d1ea9c53a850e98cfb7783c
5
5
  SHA512:
6
- metadata.gz: 805ab590d81e32061ad21253b114e354189d8fa7379564a6bfa2b5f33215b3ed3715ee6d693b1ee61d709fa66f0fc72536efe1dcc51970b48de7f45390491674
7
- data.tar.gz: a268def3988ff20934d0d218562e4b8f980457b5576803e9065a9f7b263a7371690ec510a40afa0719785868b8a3b7c31118e18a443d40ecf1ca002b474f7b99
6
+ metadata.gz: 9d408e0837a5efce7541213d3631d3d5f29dc552688cc54ca025d4add697c6443e0c6974b4bae66727eee4cbc34eb9cae37f8863b125b8725d1cdc71492480c0
7
+ data.tar.gz: 8ee4d0ab24c2d2525338cf6e44f54e67416682e3ce56db109d4460dd93d5bbdac7e038fa72fa9371817fa0f5ffd75ad68c3797fac3d365610ac29e3fefd7c48d
@@ -83,7 +83,7 @@ module Katello
83
83
 
84
84
  def find_exportable_organization
85
85
  find_organization
86
- unless @organization.can_export_library_content?
86
+ unless @organization.can_export_content?
87
87
  throw_resource_not_found(name: 'organization', id: params[:organization_id])
88
88
  end
89
89
  end
@@ -67,7 +67,7 @@ module Katello
67
67
 
68
68
  def find_exportable_organization
69
69
  find_organization
70
- unless @organization.can_export_library_content?
70
+ unless @organization.can_export_content?
71
71
  throw_resource_not_found(name: 'organization', id: params[:organization_id])
72
72
  end
73
73
  end
@@ -49,7 +49,7 @@ module Katello
49
49
  private
50
50
 
51
51
  def check_authorized
52
- fail HttpErrors::Forbidden, _("Action unauthorized to be performed in this organization.") unless ContentView.importable?
52
+ fail HttpErrors::Forbidden, _("Action unauthorized to be performed in this organization.") unless @organization.can_import_content?
53
53
  end
54
54
 
55
55
  def find_default_content_view
@@ -59,7 +59,7 @@ module Katello
59
59
 
60
60
  def find_importable_organization
61
61
  find_organization
62
- throw_resource_not_found(name: 'organization', id: params[:organization_id]) unless @organization.can_import_library_content?
62
+ throw_resource_not_found(name: 'organization', id: params[:organization_id]) unless @organization.can_import_content?
63
63
  end
64
64
 
65
65
  def metadata_params
@@ -3,10 +3,8 @@ module Katello
3
3
  apipie_concern_subst(:a_resource => N_("an erratum"), :resource => "errata")
4
4
  include Katello::Concerns::Api::V2::RepositoryContentController
5
5
 
6
- before_action :find_host, :only => [:index, :available_errata]
7
- before_action :find_optional_organization, :only => [:index, :auto_complete_search, :available_errata]
8
- before_action :find_environment, :only => :available_errata
9
- before_action :find_filter, :only => :available_errata
6
+ before_action :find_host, :only => [:index]
7
+ before_action :find_optional_organization, :only => [:index, :auto_complete_search]
10
8
 
11
9
  api :GET, "/errata", N_("List errata")
12
10
  param :organization_id, :number, :desc => N_("Organization identifier")
@@ -62,25 +60,6 @@ module Katello
62
60
  collection
63
61
  end
64
62
 
65
- api :GET, "/content_view_versions/:id/available_errata", N_("Return errata that can be added to the Content View Version via an Incremental Update. Will be removed in Katello 4.1."), :deprecated => true
66
- param :id, :number, :desc => N_("Content View Version identifier"), :required => true
67
- param :organization_id, :number, :desc => N_("Organization identifier")
68
- param :content_view_filter_id, :number, :desc => N_("Content View Filter identifier")
69
- param :repository_id, :number, :desc => N_("Repository identifier")
70
- param :environment_id, :number, :desc => N_("Environment identifier")
71
- param :cve, String, :desc => N_("CVE identifier")
72
- param :host_id, :number, :desc => N_("Host id to list applicable errata for")
73
- param :errata_restrict_applicable, :bool, :desc => N_("Return errata that are applicable to one or more hosts (defaults to true if host_id is specified)")
74
- param :errata_restrict_installable, :bool, :desc => N_("Return errata that are upgradable on one or more hosts")
75
- param_group :search, Api::V2::ApiController
76
- def available_errata
77
- params[:content_view_version_id] = params[:id]
78
- find_content_view_version
79
- params[:available_for] = "content_view_version"
80
- sort_by, sort_order, options = sort_options
81
- respond_for_index(:collection => scoped_search(index_relation, sort_by, sort_order, options))
82
- end
83
-
84
63
  private
85
64
 
86
65
  def find_host
@@ -1,6 +1,7 @@
1
1
  module Katello
2
2
  class Api::V2::HostErrataController < Api::V2::ApiController
3
3
  include Katello::Concerns::FilteredAutoCompleteSearch
4
+ include Katello::Concerns::Api::V2::HostErrataExtensions
4
5
 
5
6
  before_action :find_host, only: :index
6
7
  before_action :find_host_editable, except: :index
@@ -52,7 +53,7 @@ module Katello
52
53
 
53
54
  api :PUT, "/hosts/:host_id/errata/apply", N_("Schedule errata for installation using katello-agent. %s") % katello_agent_deprecation_text, deprecated: true
54
55
  param :host_id, :number, :desc => N_("Host ID"), :required => true
55
- param :errata_ids, Array, :desc => N_("List of Errata ids to install. Will be removed in Katello 4.1."), :required => false, :deprecated => true
56
+ param :errata_ids, Array, :desc => N_("List of Errata ids to install. Will be removed in %s") % katello_agent_removal_release, required: false, deprecated: true
56
57
 
57
58
  param_group :bulk_errata_ids
58
59
  def apply
@@ -72,36 +73,8 @@ module Katello
72
73
  api :PUT, "/hosts/:host_id/errata/applicability", N_("Force regenerate applicability.")
73
74
  param :host_id, :number, :desc => N_("Host ID"), :required => true
74
75
  def applicability
75
- task = async_task(::Actions::Katello::Host::GenerateApplicability, [@host], false)
76
- respond_for_async :resource => task
77
- end
78
-
79
- def find_bulk_errata_ids(bulk_params)
80
- #works on a structure of param_group bulk_params and transforms it into a list of errata_ids
81
- bulk_params[:included] ||= {}
82
- bulk_params[:excluded] ||= {}
83
- @errata = []
84
-
85
- unless bulk_params[:included][:ids].blank?
86
- @errata = @host.content_facet.installable_errata.where(:errata_id => bulk_params[:included][:ids])
87
- end
88
-
89
- if bulk_params[:included][:search]
90
- search_errata = @host.content_facet.installable_errata
91
- search_errata = search_errata.search_for(bulk_params[:included][:search])
92
- if @errata.any?
93
- @errata = ::Katello::Erratum.where(errata_id: @errata).or(::Katello::Erratum.where(errata_id: search_errata))
94
- else
95
- @errata = search_errata
96
- end
97
- end
98
-
99
- @errata = @errata.where.not(errata_id: bulk_params[:excluded][:ids]) unless @errata.empty? || bulk_params[:excluded][:ids].blank?
100
-
101
- if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
102
- fail HttpErrors::BadRequest, _("No errata has been specified.")
103
- end
104
- @errata.pluck(:errata_id)
76
+ Katello::Host::ContentFacet.trigger_applicability_generation(@host.id)
77
+ respond_for_async :resource => {}
105
78
  end
106
79
 
107
80
  protected
@@ -142,7 +115,7 @@ module Katello
142
115
  fail HttpErrors::NotFound, _("Couldn't find errata ids '%s'") % missing.to_sentence if missing.any?
143
116
  @errata_ids = params[:errata_ids]
144
117
  else
145
- @errata_ids = find_bulk_errata_ids(params[:bulk_errata_ids])
118
+ @errata_ids = find_bulk_errata_ids([@host], params[:bulk_errata_ids])
146
119
  end
147
120
  end
148
121
  end
@@ -15,7 +15,7 @@ module Katello
15
15
 
16
16
  def_param_group :packages_or_groups do
17
17
  param :packages, Array, :desc => N_("List of package names"), :required => false
18
- param :groups, Array, :desc => N_("List of package group names"), :required => false
18
+ param :groups, Array, :desc => N_("List of package group names (Deprecated)"), :required => false
19
19
  end
20
20
 
21
21
  api :GET, "/hosts/:host_id/packages", N_("List packages installed on the host")
@@ -120,7 +120,7 @@ module Katello
120
120
  param :content_type, String,
121
121
  :desc => N_("The type of content. The following types are supported: 'package', 'package_group' and 'errata'."),
122
122
  :required => true
123
- param :content, Array, :desc => N_("List of content (e.g. package names, package group names or errata ids)")
123
+ param :content, Array, :desc => N_("List of content (e.g. package names, package group names (Deprecated) or errata ids)")
124
124
  def install_content
125
125
  content_action
126
126
  end
@@ -43,7 +43,6 @@ module Katello
43
43
  task = async_task(::Actions::BulkAction,
44
44
  ::Actions::Katello::Repository::Sync,
45
45
  syncable_repositories,
46
- nil,
47
46
  :skip_metadata_check => skip_metadata_check,
48
47
  :validate_contents => validate_contents)
49
48
 
@@ -286,7 +286,7 @@ module Katello
286
286
  fail HttpErrors::BadRequest, _("attempted to sync without a feed URL")
287
287
  end
288
288
 
289
- task = async_task(::Actions::Katello::Repository::Sync, @repository, nil, sync_options)
289
+ task = async_task(::Actions::Katello::Repository::Sync, @repository, sync_options)
290
290
  respond_for_async :resource => task
291
291
  rescue Errors::InvalidActionOptionError => e
292
292
  raise HttpErrors::BadRequest, e.message
@@ -0,0 +1,41 @@
1
+ module Katello
2
+ module Concerns
3
+ module Api::V2::HostErrataExtensions
4
+ extend ActiveSupport::Concern
5
+
6
+ def find_bulk_errata_ids(hosts, bulk_errata_ids)
7
+ bulk_params = ActiveSupport::JSON.decode(bulk_errata_ids).deep_symbolize_keys
8
+ bulk_params[:included] ||= {}
9
+ bulk_params[:excluded] ||= {}
10
+
11
+ if bulk_params[:included][:ids].blank? && bulk_params[:included][:search].nil?
12
+ fail HttpErrors::BadRequest, _("No errata has been specified.")
13
+ end
14
+
15
+ #works on a structure of param_group bulk_params and transforms it into a list of errata_ids
16
+ errata = ::Katello::Erratum.installable_for_hosts(hosts)
17
+
18
+ if bulk_params[:included][:ids]
19
+ errata = errata.where(:errata_id => bulk_params[:included][:ids])
20
+ end
21
+
22
+ if bulk_params[:included][:search]
23
+ search_errata = ::Katello::Erratum.installable_for_hosts(hosts)
24
+ search_errata = search_errata.search_for(bulk_params[:included][:search])
25
+
26
+ if errata.any?
27
+ errata = errata.merge(search_errata)
28
+ else
29
+ errata = search_errata
30
+ end
31
+ end
32
+
33
+ if bulk_params[:excluded][:ids].present?
34
+ errata = errata.where.not(errata_id: bulk_params[:excluded][:ids])
35
+ end
36
+
37
+ errata.pluck(:errata_id)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -2,6 +2,7 @@ module Katello
2
2
  if Katello.with_remote_execution?
3
3
  class RemoteExecutionController < JobInvocationsController
4
4
  include Concerns::Api::V2::BulkHostsExtensions
5
+ include Concerns::Api::V2::HostErrataExtensions
5
6
 
6
7
  def new
7
8
  @composer = prepare_composer
@@ -30,21 +31,16 @@ module Katello
30
31
  end
31
32
 
32
33
  def hosts
33
- host_ids = params[:host_ids].is_a?(String) ? params[:host_ids].split(',') : params[:host_ids]
34
+ bulk_host_ids = ActiveSupport::JSON.decode(params[:bulk_host_ids]).deep_symbolize_keys
34
35
 
35
- bulk_params = {
36
- included: {
37
- ids: host_ids,
38
- search: params[:scoped_search]
39
- }
40
- }
41
-
42
- find_bulk_hosts('edit_hosts', bulk_params)
36
+ find_bulk_hosts('edit_hosts', bulk_host_ids)
43
37
  end
44
38
 
45
39
  def errata_inputs
46
40
  if ::Foreman::Cast.to_bool(params[:install_all])
47
41
  Erratum.installable_for_hosts(hosts).pluck(:errata_id).join(',')
42
+ elsif params[:bulk_errata_ids]
43
+ find_bulk_errata_ids(hosts, params[:bulk_errata_ids]).join(',')
48
44
  else
49
45
  params[:name]
50
46
  end
@@ -32,7 +32,15 @@ module Actions
32
32
  private
33
33
 
34
34
  def poll_external_task
35
- ::Katello::Resources::Candlepin::Job.get(external_task[:id])
35
+ task = ::Katello::Resources::Candlepin::Job.get(external_task[:id])
36
+ check_for_errors!(task)
37
+ task
38
+ end
39
+
40
+ def check_for_errors!(task)
41
+ if task[:state] == 'FAILED'
42
+ fail ::Katello::Errors::CandlepinError, task[:resultData]
43
+ end
36
44
  end
37
45
  end
38
46
  end
@@ -49,6 +49,8 @@ module Actions
49
49
 
50
50
  schedule_timeout(timeout)
51
51
  end
52
+ when Dynflow::Action::Skip
53
+ # Do not fail and goto a paused state, instead skip and send the state to warning so we do not block other host actions
52
54
  when Dynflow::Action::Timeouts::Timeout
53
55
  process_timeout
54
56
  when 'accepted'
@@ -3,22 +3,22 @@ module Actions
3
3
  module Applicability
4
4
  module Repository
5
5
  class Regenerate < Actions::EntryAction
6
- middleware.use Actions::Middleware::ExecuteIfContentsChanged
7
-
8
6
  input_format do
9
- param :repo_id, Integer
10
- param :contents_changed
7
+ param :repo_ids, Array
11
8
  end
12
9
 
13
10
  def run
14
- host_ids = ::Katello::Repository.find(input[:repo_id]).hosts_with_applicability.pluck(:id)
15
- return if host_ids.empty?
16
-
17
- host_ids.each do |host_id|
18
- ::Katello::ApplicableHostQueue.push_host(host_id)
11
+ repos = ::Katello::Repository.where(:id => input[:repo_ids]).select do |repo|
12
+ repo.last_contents_changed >= repo.last_applicability_regen
19
13
  end
20
14
 
21
- ::Katello::EventQueue.push_event(::Katello::Events::GenerateHostApplicability::EVENT_TYPE, 0)
15
+ if repos.any?
16
+ host_ids = ::Katello::RootRepository.where(:id => repos.map(&:root_id)).hosts_with_applicability.pluck(:id)
17
+ ::Katello::Host::ContentFacet.trigger_applicability_generation(host_ids) unless host_ids.empty?
18
+
19
+ ::Katello::Repository.where(:id => repos.map(&:id)).update_all(:last_applicability_regen => DateTime.now)
20
+ end
21
+ output[:regenerated => repos.map(&:id)]
22
22
  end
23
23
 
24
24
  def humanized_name
@@ -39,7 +39,7 @@ module Actions
39
39
  end
40
40
 
41
41
  if smart_proxy.has_feature?(SmartProxy::PULP3_FEATURE)
42
- plan_action(Actions::Pulp3::CapsuleContent::RefreshContentGuard, smart_proxy)
42
+ plan_action(Actions::Pulp3::ContentGuard::Refresh, smart_proxy)
43
43
  plan_action(Actions::Pulp3::Orchestration::Repository::RefreshRepos, smart_proxy, refresh_options)
44
44
  end
45
45
  plan_action(SyncCapsule, smart_proxy, refresh_options)
@@ -11,7 +11,6 @@ module Actions
11
11
 
12
12
  sequence do
13
13
  plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
14
- plan_action(GenerateApplicability, [host])
15
14
  end
16
15
  end
17
16
 
@@ -39,13 +38,8 @@ module Actions
39
38
  Rails.logger.warn("Host with ID %s has no content facet, continuing" % host_id)
40
39
  else
41
40
  begin
42
- if SmartProxy.pulp_primary&.has_feature?(SmartProxy::PULP_FEATURE)
43
- ::Katello::Pulp::Consumer.new(host.content_facet.uuid).upload_package_profile(profile)
44
- end
45
41
  simple_packages = profile.map { |item| ::Katello::Pulp::SimplePackage.new(item) }
46
42
  host.import_package_profile(simple_packages)
47
- rescue RestClient::ResourceNotFound
48
- Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host_id)
49
43
  rescue ActiveRecord::InvalidForeignKey # this happens if the host gets deleted in between the "find_by" and "import_package_profile"
50
44
  Rails.logger.warn("Host installed package list with ID %s was not able to be written to the DB (host likely is deleted), continuing" % host_id)
51
45
  end
@@ -57,6 +51,7 @@ module Actions
57
51
  #free the huge string from the memory
58
52
  input[:profile_string] = 'TRIMMED'.freeze
59
53
  UploadPackageProfile.upload(input[:host_id], profile)
54
+ ::Katello::Host::ContentFacet.trigger_applicability_generation(input[:host_id])
60
55
  end
61
56
  end
62
57
  end
@@ -13,7 +13,6 @@ module Actions
13
13
 
14
14
  sequence do
15
15
  plan_self(:host_id => host.id, :hostname => host.name, :profile_string => profile_string)
16
- plan_action(GenerateApplicability, [host])
17
16
  end
18
17
  end
19
18
 
@@ -33,52 +32,12 @@ module Actions
33
32
  Dynflow::Action::Rescue::Skip
34
33
  end
35
34
 
36
- def self.upload_modules_to_pulp(available_streams, host)
37
- query_name_streams = available_streams.map do |profile|
38
- ::Katello::ModuleStream.where(profile.slice(:name, :stream))
39
- end
40
-
41
- updated_profiles = []
42
- unless query_name_streams.empty?
43
- query_name_streams = query_name_streams.inject(&:or)
44
-
45
- bound_library_instances = host.content_facet.bound_repositories.map(&:library_instance_or_self)
46
- query = ::Katello::ModuleStream.in_repositories(bound_library_instances).
47
- select(:name, :stream, :version, :context, :arch).
48
- merge(query_name_streams)
49
-
50
- updated_profiles = query.map do |module_stream|
51
- module_stream.slice(:name, :stream, :version, :context, :arch)
52
- end
53
- end
54
-
55
- # We also need to pass module streams that are not found in the ModuleStream table
56
- # but are present on the content host
57
- unassociated_profiles = available_streams.select do |profile|
58
- updated_profiles.none? { |p| p[:name] == profile[:name] && p[:stream] == profile[:stream] }
59
- end
60
-
61
- module_stream_profile = updated_profiles + unassociated_profiles
62
-
63
- if SmartProxy.pulp_primary&.has_feature?(SmartProxy::PULP_FEATURE)
64
- unless module_stream_profile.empty?
65
- begin
66
- ::Katello::Pulp::Consumer.new(host.content_facet.uuid).
67
- upload_module_stream_profile(module_stream_profile)
68
- rescue RestClient::ResourceNotFound
69
- Rails.logger.warn("Host with ID %s was not known to Pulp, continuing" % host.id)
70
- end
71
- end
72
- end
73
- end
74
-
75
35
  def import_module_streams(payload, host)
76
36
  enabled_payload = payload.map do |profile|
77
37
  profile.slice("name", "stream", "version", "context", "arch").with_indifferent_access if profile["status"] == "enabled"
78
38
  end
79
39
  enabled_payload.compact!
80
40
 
81
- UploadProfiles.upload_modules_to_pulp(enabled_payload, host)
82
41
  host.import_module_streams(payload)
83
42
  end
84
43
 
@@ -124,6 +83,8 @@ module Actions
124
83
  module_streams.each do |module_stream_payload|
125
84
  import_module_streams(module_stream_payload, host)
126
85
  end
86
+
87
+ ::Katello::Host::ContentFacet.trigger_applicability_generation(host.id)
127
88
  end
128
89
  end
129
90
  end
@@ -1,13 +1,13 @@
1
1
  module Actions
2
2
  module Katello
3
3
  module OrphanCleanup
4
- class RemoveOrphans < Pulp::Abstract
4
+ class RemoveOrphans < Actions::Base
5
5
  input_format do
6
6
  param :capsule_id
7
7
  end
8
8
  def plan(proxy)
9
9
  sequence do
10
- plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy)
10
+ plan_action(Actions::Pulp::Orchestration::OrphanCleanup::RemoveOrphans, proxy) if (proxy.has_feature?(SmartProxy::PULP_FEATURE) || proxy.has_feature?(SmartProxy::PULP_NODE_FEATURE))
11
11
  if proxy.pulp3_enabled?
12
12
  plan_action(
13
13
  Actions::Pulp3::Orchestration::OrphanCleanup::RemoveOrphans,