forked from Katello/katello
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #24902 - pass in list of packages when publishing CV
Previously, the only way to control which packages land in content view version was by using filters, or by managing the contents of the Library versions of the repos. This commit lets you optionally specify the exact package set you want in your repository. It will look at the Library version of each repo, and copy the list of packages into the CV version. Example value for `repos_units` when calling `/katello/api/v2/content_views/2/publish`: ```json [ { "repo_label": "zoo", "rpm_filenames": [ "walrus-5.21-1.noarch.rpm", "gorilla-0.62-1.noarch.rpm" ] }, { "repo_label": "a_longer_label", "rpm_filenames": [ "facter-2.4.6-3.el7sat.x86_64.rpm", "pulp-rpm-handlers-2.13.4.9-1.el7sat.noarch.rpm" ] } ] ``` This works the same for custom and RH repos. When used with Katello#7594, you can set the CV version number as well as the list of packages in each repo. This is useful for cloning a CV version from one Katello to another.
- Loading branch information
Showing
8 changed files
with
117 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
require 'katello_test_helper' | ||
|
||
module Actions | ||
describe Katello::Repository::CloneYumContent do | ||
include Dynflow::Testing | ||
include Support::Actions::Fixtures | ||
include FactoryBot::Syntax::Methods | ||
|
||
let(:action_class) { ::Actions::Katello::Repository::CloneYumContent } | ||
let(:source_repo) { katello_repositories(:rhel_6_x86_64_dev_archive) } | ||
let(:target_repo) { katello_repositories(:rhel_6_x86_64_dev) } | ||
|
||
it 'plans to copy rpms' do | ||
action = create_action(action_class) | ||
source_repo = katello_repositories(:rhel_6_x86_64_dev_archive) | ||
target_repo = katello_repositories(:rhel_6_x86_64_dev) | ||
|
||
plan_action(action, source_repo, target_repo, [], false) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopySrpm, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyRpm, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyYumMetadataFile, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyDistribution, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyModuleStream, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyModuleDefault, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
end | ||
|
||
it 'plans to copy rpms with rpm_filenames' do | ||
action = create_action(action_class) | ||
source_repo = katello_repositories(:rhel_6_x86_64_dev_archive) | ||
source_repo.stubs(:rpms).returns([{ :filename => "rpm1.rpm" }, { :filename => "rpm2.rpm" }]) | ||
target_repo = katello_repositories(:rhel_6_x86_64_dev) | ||
|
||
plan_action(action, source_repo, target_repo, [], false, :rpm_filenames => ["rpm1.rpm", "rpm2.rpm"]) | ||
|
||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopySrpm, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyRpm, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => {"filename" => {"$in" => ["rpm1.rpm", "rpm2.rpm"]}}) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyYumMetadataFile, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyDistribution, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyModuleStream, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
assert_action_planed_with(action, ::Actions::Pulp::Repository::CopyModuleDefault, :source_pulp_id => source_repo.pulp_id, :target_pulp_id => target_repo.pulp_id, :clauses => nil) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters