katello 4.7.0.rc2 → 4.7.1
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.
- checksums.yaml +4 -4
- data/app/controllers/katello/api/v2/alternate_content_sources_controller.rb +4 -1
- data/app/controllers/katello/api/v2/products_bulk_actions_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repositories_controller.rb +1 -1
- data/app/controllers/katello/api/v2/repository_sets_controller.rb +25 -14
- data/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb +0 -1
- data/app/lib/actions/katello/repository/sync.rb +3 -3
- data/app/lib/actions/pulp3/orchestration/repository/copy_all_units.rb +1 -0
- data/app/lib/katello/resources/candlepin.rb +1 -1
- data/app/lib/katello/resources/cdn.rb +1 -1
- data/app/lib/katello/util/candlepin_repository_checker.rb +2 -0
- data/app/models/katello/concerns/host_managed_extensions.rb +4 -2
- data/app/models/katello/concerns/smart_proxy_extensions.rb +1 -1
- data/app/models/katello/content.rb +1 -1
- data/app/models/katello/glue/provider.rb +1 -1
- data/app/models/katello/root_repository.rb +4 -0
- data/app/services/katello/product_content_importer.rb +61 -5
- data/app/services/katello/pulp3/repository/apt.rb +6 -0
- data/app/services/katello/pulp3/repository/yum.rb +2 -1
- data/app/services/katello/pulp3/repository.rb +2 -2
- data/app/services/katello/pulp3/repository_mirror.rb +1 -0
- data/config/initializers/monkeys.rb +2 -1
- data/db/migrate/20221206170122_update_ignore_srpm_to_false_for_mirror_complete.rb +5 -0
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/bulk/views/products-bulk-advanced-sync-modal.html +1 -1
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/details/views/repository-advanced-sync-options.html +4 -4
- data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/repositories/repositories.routes.js +2 -2
- data/lib/katello/engine.rb +1 -0
- data/lib/katello/version.rb +1 -1
- data/lib/monkeys/fix_deb_optimized_sync.rb +35 -0
- data/lib/monkeys/{try_pulp_container_path.rb → fix_pulp_container_path.rb} +0 -0
- data/locale/action_names.rb +69 -69
- data/locale/bn/katello.po +23 -20
- data/locale/cs/katello.po +23 -20
- data/locale/de/katello.po +25 -22
- data/locale/en/katello.po +23 -20
- data/locale/es/katello.po +335 -332
- data/locale/fr/katello.po +704 -695
- data/locale/gu/katello.po +23 -20
- data/locale/hi/katello.po +23 -20
- data/locale/it/katello.po +23 -20
- data/locale/ja/katello.po +570 -561
- data/locale/ka/katello.po +2269 -2260
- data/locale/katello.pot +287 -279
- data/locale/kn/katello.po +23 -20
- data/locale/ko/katello.po +57 -53
- data/locale/mr/katello.po +23 -20
- data/locale/or/katello.po +23 -20
- data/locale/pa/katello.po +23 -20
- data/locale/pt/katello.po +23 -20
- data/locale/pt_BR/katello.po +441 -438
- data/locale/ru/katello.po +23 -20
- data/locale/ta/katello.po +23 -20
- data/locale/te/katello.po +23 -20
- data/locale/zh_CN/katello.po +694 -687
- data/locale/zh_TW/katello.po +23 -20
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/ChangeHostCVModal.js +5 -11
- data/webpack/components/extensions/HostDetails/Cards/ContentViewDetailsCard/__tests__/changeHostCVModal.test.js +2 -2
- data/webpack/components/extensions/HostDetails/DetailsTabCards/RegistrationCard.js +1 -1
- data/webpack/components/extensions/HostDetails/DetailsTabCards/SystemPropertiesCardExtensions.js +58 -1
- data/webpack/components/extensions/HostDetails/Tabs/ModuleStreamsTab/ModuleStreamsTab.js +5 -1
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/errataTab.test.js +2 -2
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/moduleStreamsTab.test.js +2 -2
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/packageInstallModal.test.js +2 -2
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/packagesTab.test.js +2 -2
- data/webpack/components/extensions/HostDetails/Tabs/__tests__/tracesTab.test.js +3 -3
- data/webpack/components/extensions/HostDetails/Tabs/customizedRexUrlHelpers.js +1 -1
- data/webpack/global_index.js +2 -0
- data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignActivationKeysForm.js +10 -10
- data/webpack/scenes/ContentViews/Delete/Steps/CVDeletionReassignHostsForm.js +10 -10
- data/webpack/scenes/ContentViews/Delete/__tests__/contentViewDelete.test.js +5 -5
- data/webpack/scenes/ContentViews/Details/Versions/BulkDelete/Steps/ReassignActivationKeys.js +9 -10
- data/webpack/scenes/ContentViews/Details/Versions/BulkDelete/Steps/ReassignHosts.js +13 -10
- data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js +18 -18
- data/webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignHostsForm.js +10 -6
- data/webpack/scenes/ContentViews/Details/Versions/Delete/__tests__/cvVersionRemove.test.js +6 -6
- data/webpack/scenes/ContentViews/components/ContentViewSelect/ContentViewSelect.js +40 -0
- data/webpack/scenes/Hosts/ChangeContentSource/actions.js +0 -1
- data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceForm.js +16 -2
- data/webpack/scenes/Hosts/ChangeContentSource/components/ContentSourceTemplate.js +13 -17
- data/webpack/scenes/Hosts/ChangeContentSource/index.js +79 -39
- data/webpack/scenes/Hosts/ChangeContentSource/styles.scss +6 -2
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8fd9bf94317048633ae54a2cf106cc08d6248b531e3da56bc68fb43fe5f018e
|
4
|
+
data.tar.gz: 76539311bac6cda0b3cceec6b5d6bdf5407ad5c836807df5f35a48f5a5395212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8de554bb59b8f31e882f41926695708f1b92107c1da3a6479aaad00f6abe3f4477d3ce010af4f6ee846796ffb7c7782cbe4df545f52caee7ce93cb24e7f8cefd
|
7
|
+
data.tar.gz: 6835bc877ac980afa81cd3166812972c0d8caac75407f670d55f8537027aab8b2f9f9e69351835ac54373a7d10f80090e02384ea9d61381b5d2eb37598a3406b
|
@@ -27,6 +27,7 @@ module Katello
|
|
27
27
|
end
|
28
28
|
|
29
29
|
api :GET, "/alternate_content_sources", N_("List alternate content sources.")
|
30
|
+
param :name, String, :desc => N_("Name of the alternate content source"), :required => false
|
30
31
|
param_group :search, Api::V2::ApiController
|
31
32
|
add_scoped_search_description_for(AlternateContentSource)
|
32
33
|
def index
|
@@ -52,7 +53,9 @@ module Katello
|
|
52
53
|
end
|
53
54
|
|
54
55
|
def index_relation
|
55
|
-
AlternateContentSource.readable.distinct
|
56
|
+
query = AlternateContentSource.readable.distinct
|
57
|
+
query = query.where(name: params[:name]) if params[:name]
|
58
|
+
query
|
56
59
|
end
|
57
60
|
|
58
61
|
api :GET, '/alternate_content_sources/:id', N_('Show an alternate content source.')
|
@@ -34,7 +34,7 @@ module Katello
|
|
34
34
|
syncable_products = @products.syncable
|
35
35
|
syncable_roots = RootRepository.where(:product_id => syncable_products).has_url
|
36
36
|
|
37
|
-
syncable_roots = syncable_roots.
|
37
|
+
syncable_roots = syncable_roots.skipable_metadata_check if skip_metadata_check || validate_contents
|
38
38
|
syncable_roots = syncable_roots.where.not(:download_policy => ::Katello::RootRepository::DOWNLOAD_ON_DEMAND) if validate_contents
|
39
39
|
|
40
40
|
syncable_repositories = Katello::Repository.where(:root_id => syncable_roots).in_default_view
|
@@ -346,7 +346,7 @@ module Katello
|
|
346
346
|
param :id, :number, :required => true, :desc => N_("repository ID")
|
347
347
|
param :source_url, String, :desc => N_("temporarily override feed URL for sync"), :required => false
|
348
348
|
param :incremental, :bool, :desc => N_("perform an incremental import"), :required => false
|
349
|
-
param :skip_metadata_check, :bool, :desc => N_("Force sync even if no upstream changes are detected. Only used with yum repositories."), :required => false
|
349
|
+
param :skip_metadata_check, :bool, :desc => N_("Force sync even if no upstream changes are detected. Only used with yum or deb repositories."), :required => false
|
350
350
|
param :validate_contents, :bool, :desc => N_("Force a sync and validate the checksums of all content. Only used with yum repositories."), :required => false
|
351
351
|
def sync
|
352
352
|
sync_options = {
|
@@ -38,12 +38,11 @@ module Katello
|
|
38
38
|
param_group :search, Api::V2::ApiController
|
39
39
|
add_scoped_search_description_for(Katello::ProductContent)
|
40
40
|
def index
|
41
|
-
collection = scoped_search(index_relation, :name, :asc, :resource_class => Katello::ProductContent)
|
41
|
+
collection = scoped_search(index_relation, :name, :asc, :resource_class => Katello::ProductContent, :custom_sort => ->(relation) { custom_sort_results(relation) })
|
42
42
|
pcf = ProductContentFinder.wrap_with_overrides(
|
43
43
|
product_contents: collection[:results],
|
44
|
-
overrides: @consumable&.content_overrides
|
45
|
-
|
46
|
-
collection[:results] = custom_sort_results(pcf)
|
44
|
+
overrides: @consumable&.content_overrides)
|
45
|
+
collection[:results] = pcf
|
47
46
|
respond(:collection => collection)
|
48
47
|
end
|
49
48
|
|
@@ -154,7 +153,13 @@ module Katello
|
|
154
153
|
:match_subscription => !content_access_mode_all,
|
155
154
|
:match_environment => content_access_mode_env,
|
156
155
|
:consumable => @consumable)
|
157
|
-
relation.merge(content_finder.product_content)
|
156
|
+
unfiltered = relation.merge(content_finder.product_content)
|
157
|
+
return unfiltered unless params[:status]
|
158
|
+
filtered_ids = ProductContentFinder.wrap_with_overrides(
|
159
|
+
product_contents: unfiltered,
|
160
|
+
overrides: @consumable&.content_overrides,
|
161
|
+
status: params[:status]).map(&:id).uniq
|
162
|
+
unfiltered.where(id: filtered_ids)
|
158
163
|
end
|
159
164
|
|
160
165
|
def find_product_content
|
@@ -236,18 +241,24 @@ module Katello
|
|
236
241
|
else
|
237
242
|
0
|
238
243
|
end
|
239
|
-
Rails.logger.debug [pc.product_name, pc.enabled_content_override, "Id: #{pc.id}", "Score: #{score}"]
|
240
244
|
score
|
241
245
|
end
|
242
246
|
|
243
|
-
def custom_sort_results(
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
247
|
+
def custom_sort_results(unsorted_relation)
|
248
|
+
return unsorted_relation unless params[:sort_by] == 'enabled_by_default'
|
249
|
+
product_content_finder = ProductContentFinder.wrap_with_overrides(
|
250
|
+
product_contents: unsorted_relation,
|
251
|
+
overrides: @consumable&.content_overrides,
|
252
|
+
status: params[:status])
|
253
|
+
sorted_pcps = if params[:sort_by] == 'enabled_by_default' && params[:sort_order] == 'desc'
|
254
|
+
product_content_finder.sort { |pca, pcb| sort_score(pca) <=> sort_score(pcb) }.reverse!
|
255
|
+
elsif params[:sort_by] == 'enabled_by_default'
|
256
|
+
product_content_finder.sort { |pca, pcb| sort_score(pca) <=> sort_score(pcb) }
|
257
|
+
else
|
258
|
+
product_content_finder
|
259
|
+
end
|
260
|
+
sort_order = sorted_pcps.map(&:id)
|
261
|
+
unsorted_relation.reorder(Arel.sql("array_position('{#{sort_order.join(',')}}'::int[], #{Katello::ProductContent.table_name}.id)"))
|
251
262
|
end
|
252
263
|
end
|
253
264
|
end
|
@@ -21,7 +21,7 @@ module Actions
|
|
21
21
|
|
22
22
|
source_url = options.fetch(:source_url, nil)
|
23
23
|
validate_contents = options.fetch(:validate_contents, false)
|
24
|
-
skip_metadata_check = options.fetch(:skip_metadata_check, false) || (validate_contents && repo.yum?)
|
24
|
+
skip_metadata_check = options.fetch(:skip_metadata_check, false) || (validate_contents && (repo.yum? || repo.deb?))
|
25
25
|
generate_applicability = options.fetch(:generate_applicability, repo.yum? || repo.deb?)
|
26
26
|
|
27
27
|
validate_repo!(repo: repo,
|
@@ -34,7 +34,7 @@ module Actions
|
|
34
34
|
pulp_sync_options[:download_policy] = ::Katello::RootRepository::DOWNLOAD_ON_DEMAND if validate_contents && repo.yum?
|
35
35
|
|
36
36
|
#pulp3 options
|
37
|
-
pulp_sync_options[:optimize] = false if skip_metadata_check && repo.yum?
|
37
|
+
pulp_sync_options[:optimize] = false if skip_metadata_check && (repo.yum? || repo.deb?)
|
38
38
|
|
39
39
|
sequence do
|
40
40
|
if validate_contents
|
@@ -85,7 +85,7 @@ module Actions
|
|
85
85
|
def validate_repo!(repo:, source_url:, validate_contents:, skip_metadata_check:, skip_candlepin_check:)
|
86
86
|
fail ::Katello::Errors::InvalidActionOptionError, _("Unable to sync repo. This repository does not have a feed url.") if repo.url.blank? && source_url.blank?
|
87
87
|
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot validate contents on non-yum/deb repositories.") if validate_contents && !repo.yum? && !repo.deb?
|
88
|
-
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum repositories.") if skip_metadata_check && !repo.yum?
|
88
|
+
fail ::Katello::Errors::InvalidActionOptionError, _("Cannot skip metadata check on non-yum/deb repositories.") if skip_metadata_check && !repo.yum? && !repo.deb?
|
89
89
|
::Katello::Util::CandlepinRepositoryChecker.check_repository_for_sync!(repo) if repo.yum? && !skip_candlepin_check
|
90
90
|
end
|
91
91
|
|
@@ -24,6 +24,7 @@ module Actions
|
|
24
24
|
copy_actions = []
|
25
25
|
#since we're creating a new version from the first repo, start copying at the 2nd
|
26
26
|
source_repositories[1..-1].each do |source_repo|
|
27
|
+
# TODO: In a future refactor, can :copy_all be utilized? Filters should not be needed in this code segment.
|
27
28
|
copy_actions << plan_action(Actions::Pulp3::Repository::CopyContent, source_repo, smart_proxy, target_repo,
|
28
29
|
filter_ids: filter_ids, solve_dependencies: solve_dependencies,
|
29
30
|
rpm_filenames: rpm_filenames, remove_all: false)
|
@@ -33,6 +33,8 @@ module Katello
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.repository_exist_in_backend?(repository)
|
36
|
+
return false if repository.root.content_id.blank?
|
37
|
+
|
36
38
|
::Katello::Resources::Candlepin::Content.get(repository.organization.label, repository.root.content_id)
|
37
39
|
true
|
38
40
|
rescue RestClient::NotFound
|
@@ -124,8 +124,10 @@ module Katello
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def refresh_content_host_status
|
127
|
-
|
128
|
-
status
|
127
|
+
if content_facet&.present?
|
128
|
+
self.host_statuses.where(type: ::Katello::HostStatusManager::STATUSES.map(&:name)).each do |status|
|
129
|
+
status.refresh!
|
130
|
+
end
|
129
131
|
end
|
130
132
|
refresh_global_status
|
131
133
|
end
|
@@ -187,7 +187,7 @@ module Katello
|
|
187
187
|
config.host = uri.host
|
188
188
|
config.scheme = uri.scheme
|
189
189
|
pulp3_ssl_configuration(config)
|
190
|
-
config.debugging =
|
190
|
+
config.debugging = ::Foreman::Logging.logger('katello/pulp_rest').debug?
|
191
191
|
config.timeout = SETTINGS[:katello][:rest_client_timeout]
|
192
192
|
config.logger = ::Foreman::Logging.logger('katello/pulp_rest')
|
193
193
|
config.username = self.setting(PULP3_FEATURE, 'username')
|
@@ -41,7 +41,7 @@ module Katello
|
|
41
41
|
cp_products = ::Katello::Resources::Candlepin::Product.all(org.label, [:id, :productContent])
|
42
42
|
product_hash = cp_products.group_by { |prod| prod['id'] }
|
43
43
|
|
44
|
-
prod_content_importer = Katello::ProductContentImporter.new
|
44
|
+
prod_content_importer = Katello::ProductContentImporter.new(product_hash)
|
45
45
|
org.products.each do |product|
|
46
46
|
product_json = product_hash[product.cp_id]&.first
|
47
47
|
|
@@ -122,7 +122,7 @@ module Katello
|
|
122
122
|
cp_products = ::Katello::Resources::Candlepin::Product.all(organization.label, [:id, :name, :multiplier, :productContent])
|
123
123
|
cp_products = cp_products.select { |prod| Glue::Candlepin::Product.engineering_product_id?(prod['id']) }
|
124
124
|
|
125
|
-
prod_content_importer = Katello::ProductContentImporter.new
|
125
|
+
prod_content_importer = Katello::ProductContentImporter.new(cp_products)
|
126
126
|
|
127
127
|
Katello::Logging.time("Imported #{cp_products.size} products") do
|
128
128
|
cp_products.each do |product_json|
|
@@ -21,6 +21,7 @@ module Katello
|
|
21
21
|
CHECKSUM_TYPES = %w(sha1 sha256).freeze
|
22
22
|
|
23
23
|
SUBSCRIBABLE_TYPES = [Repository::YUM_TYPE, Repository::OSTREE_TYPE, Repository::DEB_TYPE].freeze
|
24
|
+
SKIPABLE_METADATA_TYPES = [Repository::YUM_TYPE, Repository::DEB_TYPE].freeze
|
24
25
|
|
25
26
|
CONTENT_ATTRIBUTE_RESTRICTIONS = {
|
26
27
|
:download_policy => [Repository::YUM_TYPE, Repository::DEB_TYPE, Repository::DOCKER_TYPE]
|
@@ -101,6 +102,7 @@ module Katello
|
|
101
102
|
:message => _("must be one of the following: %s") % HTTP_PROXY_POLICIES.join(', ')
|
102
103
|
}
|
103
104
|
scope :subscribable, -> { where(content_type: RootRepository::SUBSCRIBABLE_TYPES) }
|
105
|
+
scope :skipable_metadata_check, -> { where(content_type: RootRepository::SKIPABLE_METADATA_TYPES) }
|
104
106
|
scope :has_url, -> { where.not(:url => nil) }
|
105
107
|
scope :with_repository_attribute, ->(attr, value) { joins(:repositories).where("#{Katello::Repository.table_name}.#{attr}" => value) }
|
106
108
|
scope :in_content_view_version, ->(version) { with_repository_attribute(:content_view_version_id, version) }
|
@@ -225,6 +227,8 @@ module Katello
|
|
225
227
|
errors.add(:ignorable_content, N_("Invalid value specified for ignorable content."))
|
226
228
|
elsif ignorable_content.any? { |item| !IGNORABLE_CONTENT_UNIT_TYPES.include?(item) }
|
227
229
|
errors.add(:ignorable_content, N_("Invalid value specified for ignorable content. Permissible values %s") % IGNORABLE_CONTENT_UNIT_TYPES.join(","))
|
230
|
+
elsif self.mirroring_policy == MIRRORING_POLICY_COMPLETE
|
231
|
+
errors.add(:ignorable_content, N_("Ignore SRPMs can not be set in combination with 'Complete Mirroring' mirroring policy."))
|
228
232
|
end
|
229
233
|
end
|
230
234
|
|
@@ -22,32 +22,75 @@ module Katello
|
|
22
22
|
# }
|
23
23
|
attr_reader :content_url_updated
|
24
24
|
|
25
|
-
def initialize
|
25
|
+
def initialize(cp_products = [])
|
26
26
|
@contents_to_create = []
|
27
27
|
@product_contents_to_create = []
|
28
28
|
@product_mapping = {}
|
29
29
|
@content_url_updated = []
|
30
|
+
@cp_products = cp_products
|
30
31
|
end
|
31
32
|
|
32
33
|
def add_product_content(product, product_content_json)
|
33
34
|
@product_mapping[product] = product_content_json.map(&:with_indifferent_access)
|
34
35
|
end
|
35
36
|
|
37
|
+
def find_product_for_content(content_id)
|
38
|
+
prod = @cp_products.find do |prod_json|
|
39
|
+
prod_json['productContent'].any? do |product_content_json|
|
40
|
+
product_content_json["content"]["id"] == content_id
|
41
|
+
end
|
42
|
+
end
|
43
|
+
::Katello::Product.find_by(cp_id: prod["id"]) if prod
|
44
|
+
end
|
45
|
+
|
46
|
+
def fetch_product_contents_to_move(product, prod_contents_json)
|
47
|
+
content_ids = prod_contents_json.map { |pc| pc[:content][:id] }
|
48
|
+
# Identify if there are any product_content that should not be
|
49
|
+
# part of this product.
|
50
|
+
product_contents_to_delete_or_move = product.
|
51
|
+
product_contents.
|
52
|
+
joins(:content).
|
53
|
+
where.not(content: { cp_content_id: content_ids })
|
54
|
+
# Identify if product content actually moved between 2 different products
|
55
|
+
product_contents_to_delete_or_move.select do |pc|
|
56
|
+
content_exists?(product.organization, pc.content)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def handle_product_moves(product, prod_contents_json)
|
61
|
+
product_contents_to_move = fetch_product_contents_to_move(product, prod_contents_json)
|
62
|
+
moved_product_contents = []
|
63
|
+
product_contents_to_move.each do |pc|
|
64
|
+
content = pc.content
|
65
|
+
root_repo = product.root_repositories.find_by(content_id: content.cp_content_id)
|
66
|
+
actual_product = find_product_for_content(content.cp_content_id)
|
67
|
+
if actual_product.present? && root_repo.present? && root_repo.product != actual_product
|
68
|
+
root_repo.update!(product_id: actual_product.id)
|
69
|
+
pc.update!(product_id: actual_product.id)
|
70
|
+
moved_product_contents << pc
|
71
|
+
else
|
72
|
+
pc.destroy!
|
73
|
+
end
|
74
|
+
end
|
75
|
+
product.reload unless product_contents_to_move.blank?
|
76
|
+
|
77
|
+
moved_product_contents
|
78
|
+
end
|
79
|
+
|
36
80
|
def import
|
37
81
|
return if @product_mapping.blank?
|
38
|
-
|
82
|
+
moved_product_contents = []
|
39
83
|
@product_mapping.each do |product, prod_contents_json|
|
84
|
+
moved_product_contents += handle_product_moves(product, prod_contents_json)
|
40
85
|
existing_product_contents = product.product_contents.to_a
|
41
|
-
|
42
86
|
prod_contents_json.each do |prod_content_json|
|
43
87
|
content = create_or_update_content(product, prod_content_json)
|
44
88
|
existing_content_map[content.cp_content_id] = content if content.new_record?
|
45
89
|
create_or_update_product_content(product, existing_product_contents, content, prod_content_json[:enabled])
|
46
90
|
end
|
47
91
|
end
|
48
|
-
|
49
92
|
::Katello::Content.import(@contents_to_create, recursive: true)
|
50
|
-
::Katello::ProductContent.import(
|
93
|
+
::Katello::ProductContent.import(fetch_product_contents_to_create(moved_product_contents))
|
51
94
|
end
|
52
95
|
|
53
96
|
private def existing_content_map
|
@@ -60,6 +103,19 @@ module Katello
|
|
60
103
|
@existing_content_map
|
61
104
|
end
|
62
105
|
|
106
|
+
private def content_exists?(org, content)
|
107
|
+
Resources::Candlepin::Content.get(org.label, content.cp_content_id)
|
108
|
+
true
|
109
|
+
rescue RestClient::NotFound
|
110
|
+
false
|
111
|
+
end
|
112
|
+
|
113
|
+
private def fetch_product_contents_to_create(moved_product_contents)
|
114
|
+
@product_contents_to_create.select do |pc|
|
115
|
+
moved_product_contents.none? { |mpc| mpc.content_id == pc.content_id && mpc.product_id == pc.product_id }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
63
119
|
private def create_or_update_content(product, prod_content_json)
|
64
120
|
content = existing_content_map[prod_content_json[:content][:id].to_s]
|
65
121
|
if content
|
@@ -24,6 +24,12 @@ module Katello
|
|
24
24
|
common_remote_options.merge(deb_remote_options)
|
25
25
|
end
|
26
26
|
|
27
|
+
def sync_url_params(sync_options)
|
28
|
+
params = super
|
29
|
+
params[:optimize] = sync_options[:optimize] if sync_options.key?(:optimize)
|
30
|
+
params
|
31
|
+
end
|
32
|
+
|
27
33
|
def mirror_remote_options
|
28
34
|
super.merge(
|
29
35
|
{
|
@@ -210,7 +210,8 @@ module Katello
|
|
210
210
|
tasks << add_content(slice, first_slice)
|
211
211
|
first_slice = false
|
212
212
|
end
|
213
|
-
|
213
|
+
# If we're merging composite cv repositories, don't clear out the Pulp repository.
|
214
|
+
elsif remove_all
|
214
215
|
tasks << remove_all_content
|
215
216
|
end
|
216
217
|
tasks
|
@@ -200,7 +200,7 @@ module Katello
|
|
200
200
|
|
201
201
|
def sync_url_params(_sync_options)
|
202
202
|
params = {remote: repo.remote_href, mirror: repo.root.mirroring_policy == Katello::RootRepository::MIRRORING_POLICY_CONTENT}
|
203
|
-
params[:skip_types] = skip_types if skip_types
|
203
|
+
params[:skip_types] = skip_types if (skip_types && repo.root.mirroring_policy != Katello::RootRepository::MIRRORING_POLICY_COMPLETE)
|
204
204
|
params
|
205
205
|
end
|
206
206
|
|
@@ -447,7 +447,7 @@ module Katello
|
|
447
447
|
end
|
448
448
|
|
449
449
|
def append_proxy_cacert(options)
|
450
|
-
if root.http_proxy&.cacert && options.key?(:cacert)
|
450
|
+
if root.http_proxy&.cacert&.present? && options.key?(:cacert)
|
451
451
|
options[:cacert] += "\n#{root.http_proxy&.cacert}"
|
452
452
|
end
|
453
453
|
options
|
@@ -132,6 +132,7 @@ module Katello
|
|
132
132
|
sync_params = repo_service.sync_url_params(options)
|
133
133
|
sync_params[:remote] = remote_href
|
134
134
|
if repo.yum?
|
135
|
+
sync_params.delete(:skip_types) if sync_params[:skip_types]
|
135
136
|
sync_params[:sync_policy] = 'mirror_complete'
|
136
137
|
else
|
137
138
|
sync_params.delete(:sync_policy)
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
<div class="help-block">
|
14
14
|
<span translate>
|
15
|
-
Selecting "Complete Sync" will cause only
|
15
|
+
Selecting "Complete Sync" will cause only yum/deb repositories of the selected product to be synced.
|
16
16
|
</span>
|
17
17
|
</div>
|
18
18
|
|
@@ -12,7 +12,7 @@
|
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
|
15
|
-
<div class="radio"
|
15
|
+
<div class="radio">
|
16
16
|
<label>
|
17
17
|
<input type="radio" ng-model="syncType" value="skipMetadataCheck" />
|
18
18
|
<span translate>
|
@@ -21,10 +21,10 @@
|
|
21
21
|
</label>
|
22
22
|
<div class="help-block">
|
23
23
|
<span translate>
|
24
|
-
Sync even if the upstream metadata appears to have no change. This option is only relevant for yum repositories and will take longer than an optimized sync. Choose this option if:
|
24
|
+
Sync even if the upstream metadata appears to have no change. This option is only relevant for yum/deb repositories and will take longer than an optimized sync. Choose this option if:
|
25
25
|
</span>
|
26
26
|
<ul class="list-aligned">
|
27
|
-
<li translate>One or more
|
27
|
+
<li translate>One or more packages are not showing up in the local repository even though they exist in the upstream repository.</li>
|
28
28
|
</ul>
|
29
29
|
</div>
|
30
|
-
</div>
|
30
|
+
</div>
|
@@ -169,7 +169,7 @@
|
|
169
169
|
})
|
170
170
|
.state('product.repository.tasks.index', {
|
171
171
|
url: '/tasks',
|
172
|
-
permission: '
|
172
|
+
permission: 'view_products',
|
173
173
|
templateUrl: 'products/details/repositories/details/views/repository-tasks.html',
|
174
174
|
ncyBreadcrumb: {
|
175
175
|
label: "{{'Tasks' | translate }}",
|
@@ -178,7 +178,7 @@
|
|
178
178
|
})
|
179
179
|
.state('product.repository.tasks.details', {
|
180
180
|
url: '/tasks/:taskId',
|
181
|
-
permission: '
|
181
|
+
permission: 'view_products',
|
182
182
|
controller: 'TaskDetailsController',
|
183
183
|
templateUrl: 'tasks/views/task-details.html',
|
184
184
|
ncyBreadcrumb: {
|
data/lib/katello/engine.rb
CHANGED
@@ -214,6 +214,7 @@ module Katello
|
|
214
214
|
::Api::V2::HostsController.include Katello::Concerns::Api::V2::HostsControllerExtensions
|
215
215
|
::Api::V2::HostgroupsController.include Katello::Concerns::Api::V2::HostgroupsControllerExtensions
|
216
216
|
::Api::V2::SmartProxiesController.include Katello::Concerns::Api::V2::SmartProxiesControllerExtensions
|
217
|
+
::Api::V2::RegistrationController.include ::Foreman::Controller::SmartProxyAuth
|
217
218
|
::Api::V2::RegistrationController.prepend Katello::Concerns::Api::V2::RegistrationControllerExtensions
|
218
219
|
::Api::V2::RegistrationCommandsController.include Katello::Concerns::Api::V2::RegistrationCommandsControllerExtensions
|
219
220
|
|
data/lib/katello/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'pulp_deb_client'
|
2
|
+
PulpDebClient::AptRepositorySyncURL.class_eval do
|
3
|
+
# Initializes the object
|
4
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
5
|
+
def initialize(attributes = {})
|
6
|
+
unless attributes.is_a?(Hash)
|
7
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::AptRepositorySyncURL` initialize method"
|
8
|
+
end
|
9
|
+
|
10
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
11
|
+
attributes = attributes.each_with_object({}) do |(k, v), h|
|
12
|
+
unless self.class.attribute_map.key?(k.to_sym)
|
13
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::AptRepositorySyncURL`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
14
|
+
end
|
15
|
+
h[k.to_sym] = v
|
16
|
+
end
|
17
|
+
|
18
|
+
if attributes.key?(:remote)
|
19
|
+
self.remote = attributes[:remote]
|
20
|
+
end
|
21
|
+
|
22
|
+
if attributes.key?(:mirror)
|
23
|
+
self.mirror = attributes[:mirror]
|
24
|
+
else
|
25
|
+
self.mirror = false
|
26
|
+
end
|
27
|
+
|
28
|
+
if attributes.key?(:optimize)
|
29
|
+
self.optimize = attributes[:optimize]
|
30
|
+
# Monkey-patch here. Rest of the initializer is copied from the gem code.
|
31
|
+
#else
|
32
|
+
# self.optimize = true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
File without changes
|