Skip to content

Commit 8e45624

Browse files
committed
WIP: Make structured APT mandatory
1 parent d8ed5ab commit 8e45624

File tree

24 files changed

+133
-191
lines changed

24 files changed

+133
-191
lines changed

app/controllers/katello/api/v2/repositories_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,6 @@ def construct_repo_from_params(repo_params) # rubocop:disable Metrics/AbcSize
667667
root.deb_releases = repo_params[:deb_releases] if repo_params[:deb_releases]
668668
root.deb_components = repo_params[:deb_components] if repo_params[:deb_components]
669669
root.deb_architectures = repo_params[:deb_architectures] if repo_params[:deb_architectures]
670-
root.content_id = 'INITIAL_DUMMY_VALUE' unless Setting['deb_enable_structured_apt']
671670
end
672671

673672
if root.ansible_collection?

app/lib/actions/candlepin/product/content_create.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ class ContentCreate < Candlepin::Abstract
1616
def run
1717
content_url = input[:content_url]
1818
if input[:type] == ::Katello::Repository::DEB_TYPE
19-
# We must retrieve the repository in the run phase, so the latest Pulp version_href is
20-
# already set. This is needed to retrieve the latest repository.deb_content_url_options!
2119
repository = ::Katello::Repository.find(input[:repository_id])
22-
if repository.deb_using_structured_apt?
23-
content_url += repository.deb_content_url_options
24-
end
20+
content_url += repository.deb_content_url_options
2521
end
2622

2723
output[:response] = ::Katello::Resources::Candlepin::Content.

app/lib/actions/candlepin/product/content_update.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ class ContentUpdate < Candlepin::Abstract
1616
end
1717

1818
def finalize
19+
# We must use finalize, because Katello::Product::ContentCreate only updates repository.content_id during finalize!
1920
content_url = input[:content_url]
20-
# We must retrieve the repository in the finalize phase, because Katello::Product::ContentCreate
21-
# only updates the repository.content_id in the finalize phase!
2221
repository = ::Katello::Repository.find(input[:repository_id])
23-
if repository.deb_using_structured_apt?
22+
if repository.deb?
2423
content_url += repository.deb_content_url_options
2524
end
2625

app/lib/actions/katello/content_view/refresh_rolling_repo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def run
2626

2727
repository.version_href = library_instance.version_href
2828
repository.publication_href = library_instance.publication_href
29-
if repository.deb_using_structured_apt?
29+
if repository.deb?
3030
repository.content_id = library_instance.content_id
3131
end
3232
repository.save!

app/lib/actions/katello/product/content_create.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def plan(repository)
4545
def finalize
4646
root = ::Katello::RootRepository.find(input[:root_repository_id])
4747
content_url = root.custom_content_path
48-
if root.deb_using_structured_apt?
48+
if root.deb?
4949
repository = ::Katello::Repository.find(input[:repository_id])
5050
content_url += repository.deb_content_url_options
5151
repository.update(:content_id => input[:content_id])

app/lib/actions/katello/product/content_destroy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def plan(repository)
1515
::Katello::ProductContent.where(product_id: root_repository.product_id,
1616
content_id: katello_content_id).destroy_all
1717

18-
if root_repository.repositories.count <= 1 || repository.deb_using_structured_apt?
18+
if root_repository.repositories.count <= 1 || repository.deb?
1919
plan_action(Candlepin::Product::ContentDestroy,
2020
owner: root_repository.product.organization.label,
2121
content_id: repository.content_id)

app/lib/actions/katello/repository/clone_contents.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def plan(source_repositories, new_repository, options)
2626
index_options = {id: new_repository.id, force_index: true}
2727
index_options[:source_repository_id] = source_repositories.first.id if source_repositories.count == 1 && filters.empty? && rpm_filenames.nil?
2828

29-
if new_repository.deb_using_structured_apt? && generate_metadata
29+
if new_repository.deb? && generate_metadata
3030
plan_action(Candlepin::Product::ContentUpdate,
3131
owner: new_repository.organization.label,
3232
repository_id: new_repository.id,

app/lib/actions/katello/repository/create.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def humanized_name
6464
end
6565

6666
def create_content?(repository, clone)
67-
if repository.deb_using_structured_apt?
67+
if repository.deb?
6868
return true
6969
elsif clone || repository.content
7070
return false

app/lib/actions/katello/repository/destroy.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def delete_empty_repo_filters(repository)
8686
end
8787

8888
def handle_custom_content(repository, remove_from_content_view_versions)
89-
#if this is the last instance of a custom repo or a deb repo using structured APT, destroy the content
90-
if remove_from_content_view_versions || repository.root.repositories.where.not(id: repository.id).empty? || repository.deb_using_structured_apt?
91-
# Never destroy content for structured apt rolling repo clones, because it belongs to the library instance
92-
return if repository.deb_using_structured_apt? && repository.content_view.rolling?
89+
# If this is the last instance of a custom repo or a deb repo, then destroy the content
90+
if remove_from_content_view_versions || repository.root.repositories.where.not(id: repository.id).empty? || repository.deb?
91+
# Never destroy content for deb rolling repo clones, it belongs to the library instance!
92+
return if repository.deb? && repository.content_view.rolling?
9393

9494
plan_action(::Actions::Katello::Product::ContentDestroy, repository)
9595
end

app/lib/actions/katello/repository/finish_upload.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def plan(repository, options = {})
1515
generate_metadata = options.fetch(:generate_metadata, true)
1616
plan_action(Katello::Repository::MetadataGenerate, repository, :dependency => import_upload_task, :force_publication => true) if generate_metadata
1717

18-
if repository.deb_using_structured_apt? && generate_metadata
18+
if repository.deb? && generate_metadata
1919
plan_action(::Actions::Candlepin::Product::ContentUpdate,
2020
owner: repository.organization.label,
2121
repository_id: repository.id,

0 commit comments

Comments
 (0)