-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #15978 - Fix host-collection content cmds (#452)
host-collection [package|package-group|erratum] [install|update|remove] This change is needed due to host unification. The api changes slightly to ensure bulk host operations go through the Foreman API rather than the Katello api.
- Loading branch information
Showing
5 changed files
with
102 additions
and
6 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,37 @@ | ||
require_relative '../test_helper' | ||
require 'hammer_cli_katello/host_collection' | ||
|
||
module HammerCLIKatello | ||
describe HostCollection::InstallContentBaseCommand do | ||
it 'installs packages to hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :install_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['wget'] | ||
end | ||
|
||
run_cmd(%w(host-collection package install --id 3 --packages wget --organization-id 1)) | ||
end | ||
|
||
it 'installs package groups to hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :install_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['birds'] | ||
end | ||
|
||
run_cmd(%w(host-collection package-group install --id 3 | ||
--package-groups birds --organization-id 1)) | ||
end | ||
|
||
it 'installs erratum to hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :install_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['Bird_Erratum'] | ||
end | ||
|
||
run_cmd(%w(host-collection erratum install --id 3 --errata Bird_Erratum --organization-id 1)) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require_relative '../test_helper' | ||
require 'hammer_cli_katello/host_collection' | ||
|
||
module HammerCLIKatello | ||
describe HostCollection::RemoveContentBaseCommand do | ||
it 'removes packages from hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :remove_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['wget'] | ||
end | ||
|
||
run_cmd(%w(host-collection package remove --id 3 --packages wget --organization-id 1)) | ||
end | ||
|
||
it 'removes package groups from hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :remove_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['birds'] | ||
end | ||
|
||
run_cmd(%w(host-collection package-group remove --id 3 | ||
--package-groups birds --organization-id 1)) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require_relative '../test_helper' | ||
require 'hammer_cli_katello/host_collection' | ||
|
||
module HammerCLIKatello | ||
describe HostCollection::UpdateContentBaseCommand do | ||
it 'updates packages on hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :update_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['wget'] | ||
end | ||
|
||
run_cmd(%w(host-collection package update --id 3 --packages wget --organization-id 1)) | ||
end | ||
|
||
it 'updates package groups on hosts in a host collection' do | ||
api_expects(:hosts_bulk_actions, :update_content) do |p| | ||
p['organization_id'] == 1 && | ||
p['included'] == { search: "host_collection_id=\"3\"" } && | ||
p['content'] == ['birds'] | ||
end | ||
|
||
run_cmd(%w(host-collection package-group update --id 3 | ||
--package-groups birds --organization-id 1)) | ||
end | ||
end | ||
end |