Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refs #36665 - Remove katello-agent end points #904

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/hammer_cli_katello.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def self.exception_handler_class
require 'hammer_cli_katello/local_helper'
require 'hammer_cli_katello/apipie_helper'
require 'hammer_cli_katello/content_export_helper'

require 'hammer_cli_katello/unsupported_katello_agent_command_helper'
# commands
HammerCLI::MainCommand.lazy_subcommand("activation-key", _("Manipulate activation keys"),
'HammerCLIKatello::ActivationKeyCommand',
Expand Down
15 changes: 0 additions & 15 deletions lib/hammer_cli_katello/host_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,6 @@ def hosts_bulk_action_id(options)
end
end

class InstallContentBaseCommand < ContentBaseCommand
action :install_content
command_name "install"
end

class UpdateContentBaseCommand < ContentBaseCommand
action :update_content
command_name "update"
end

class RemoveContentBaseCommand < ContentBaseCommand
action :remove_content
command_name "remove"
end

require 'hammer_cli_katello/host_collection_package'
subcommand HammerCLIKatello::HostCollectionPackageCommand.command_name,
HammerCLIKatello::HostCollectionPackageCommand.desc,
Expand Down
32 changes: 8 additions & 24 deletions lib/hammer_cli_katello/host_collection_erratum.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
module HammerCLIKatello
class HostCollectionErratumCommand < HammerCLIKatello::Command
command_name "erratum"
desc _("Manipulate errata for a host collection")
desc "Manage errata on your host collections. "\
"These commands are no longer available. "\
"Use the remote execution equivalent"

class InstallCommand < HammerCLIKatello::HostCollection::InstallContentBaseCommand
desc _("Install errata on content hosts contained within a host collection")
success_message _("Successfully scheduled installation of errata.")
failure_message _("Could not schedule installation of errata")

option('--errata',
'ERRATA',
_("List of Errata to install"),
:required => true,
:format => HammerCLI::Options::Normalizers::List.new,
:attribute_name => :content)

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_errata_install`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
class InstallCommand < HammerCLIKatello::Command
command_name "install"
def self.rex_feature
"katello_errata_install"
end

def content_type
'errata'
end
include UnsupportedKatelloAgentCommandHelper
end

autoload_subcommands
Expand Down
77 changes: 20 additions & 57 deletions lib/hammer_cli_katello/host_collection_package.rb
Original file line number Diff line number Diff line change
@@ -1,72 +1,35 @@
module HammerCLIKatello
class HostCollectionPackageCommand < HammerCLIKatello::Command
command_name "package"
desc _("Manipulate packages for a host collection")

module PackageContentType
def self.included(base)
base.option('--packages',
'PACKAGES',
_("comma-separated list of packages to install"),
:required => true,
:format => HammerCLI::Options::Normalizers::List.new,
:attribute_name => :content)
desc "Manage packages on your host collections. "\
"These commands are no longer available. "\
"Use the remote execution equivalent"

class InstallCommand < HammerCLIKatello::Command
command_name "install"
def self.rex_feature
"katello_package_install"
end

def content_type
'package'
end
include UnsupportedKatelloAgentCommandHelper
end

class InstallCommand < HammerCLIKatello::HostCollection::InstallContentBaseCommand
include PackageContentType
desc _("Install packages on content hosts contained within a host collection")
success_message _("Successfully scheduled installation of package(s).")
failure_message _("Could not schedule installation of package(s)")

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_install`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
class UpdateCommand < HammerCLIKatello::Command
command_name "update"
def self.rex_feature
"katello_package_update"
end
end

class UpdateCommand < HammerCLIKatello::HostCollection::UpdateContentBaseCommand
include PackageContentType
desc _("Update packages on content hosts contained within a host collection")
success_message _("Successfully scheduled update of package(s).")
failure_message _("Could not schedule update of package(s)")

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_update`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
end
include UnsupportedKatelloAgentCommandHelper
end

class RemoveCommand < HammerCLIKatello::HostCollection::RemoveContentBaseCommand
include PackageContentType
desc _("Remove packages on content hosts contained within a host collection")
success_message _("Successfully scheduled removal of package(s).")
failure_message _("Could not schedule removal of package(s)")

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_remove`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
class RemoveCommand < HammerCLIKatello::Command
command_name "remove"
def self.rex_feature
"katello_package_remove"
end

include UnsupportedKatelloAgentCommandHelper
end

autoload_subcommands
Expand Down
77 changes: 20 additions & 57 deletions lib/hammer_cli_katello/host_collection_package_group.rb
Original file line number Diff line number Diff line change
@@ -1,72 +1,35 @@
module HammerCLIKatello
class HostCollectionPackageGroupCommand < HammerCLIKatello::Command
command_name "package-group"
desc _("Manipulate package-groups for a host collection")

module PackageGroupContentType
def self.included(base)
base.option('--package-groups',
'PACKAGE-GROUPS',
_("comma-separated list of package-groups to install"),
:required => true,
:format => HammerCLI::Options::Normalizers::List.new,
:attribute_name => :content)
desc "Manage package-groups on your host collections. "\
"These commands are no longer available. "\
"Use the remote execution equivalent"

class InstallCommand < HammerCLIKatello::Command
command_name "install"
def self.rex_feature
"katello_group_install"
end

def content_type
'package_group'
end
include UnsupportedKatelloAgentCommandHelper
end

class InstallCommand < HammerCLIKatello::HostCollection::InstallContentBaseCommand
include PackageGroupContentType
desc _("Install package-groups on content hosts contained within a host collection")
success_message _("Successfully scheduled installation of package-group(s).")
failure_message _("Could not schedule installation of package-group(s)")

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_group_install`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
class UpdateCommand < HammerCLIKatello::Command
command_name "update"
def self.rex_feature
"katello_group_update"
end
end

class UpdateCommand < HammerCLIKatello::HostCollection::UpdateContentBaseCommand
include PackageGroupContentType
desc _("Update package-groups on content hosts contained within a host collection")
success_message _("Successfully scheduled update of package-groups(s).")
failure_message _("Could not schedule update of package-group(s)")

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_group_update`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
end
include UnsupportedKatelloAgentCommandHelper
end

class RemoveCommand < HammerCLIKatello::HostCollection::RemoveContentBaseCommand
include PackageGroupContentType
desc _("Remove package-groups on content hosts contained within a host collection")
success_message _("Successfully scheduled removal of package-groups(s).")
failure_message _("Could not schedule removal of package-group(s)")

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_group_remove`. Specify the host collection with the --search-query " \
"parameter, e.g. `--search-query \"host_collection = MyCollection\"` or " \
"`--search-query \"host_collection_id=6\"`."
super
class RemoveCommand < HammerCLIKatello::Command
command_name "remove"
def self.rex_feature
"katello_group_remove"
end

include UnsupportedKatelloAgentCommandHelper
end

autoload_subcommands
Expand Down
16 changes: 4 additions & 12 deletions lib/hammer_cli_katello/host_errata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ class HostErrata < HammerCLIKatello::Command
desc "Manage errata on your hosts"

class ApplyCommand < HammerCLIKatello::SingleResourceCommand
include HammerCLIForemanTasks::Async
resource :host_errata, :apply
command_name "apply"
success_message _("Errata is being applied with task %{id}.")
failure_message _("Could not apply errata")

build_options(without: ['ids'])

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_errata_install`."
super
def self.rex_feature
"katello_errata_install"
end

include UnsupportedKatelloAgentCommandHelper
end

class ListCommand < HammerCLIKatello::ListCommand
Expand Down
77 changes: 18 additions & 59 deletions lib/hammer_cli_katello/host_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,84 +12,43 @@ class ListCommand < HammerCLIKatello::ListCommand
build_options
end

class InstallCommand < HammerCLIKatello::SingleResourceCommand
include HammerCLIForemanTasks::Async
resource :host_packages, :install
class InstallCommand < HammerCLIKatello::Command
command_name "install"
success_message "Packages install successfully."
failure_message "Could not install packages"

validate_options do
option(:option_packages).required
def self.rex_feature
"katello_package_install"
end

build_options :without => [:groups]

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_install`."
super
end
include UnsupportedKatelloAgentCommandHelper
end

class UpgradeCommand < HammerCLIKatello::SingleResourceCommand
include HammerCLIForemanTasks::Async
resource :host_packages, :upgrade
class UpgradeCommand < HammerCLIKatello::Command
command_name "upgrade"
success_message "Packages upgraded successfully."
failure_message "Could not upgrade packages"

build_options

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_update`."
super
def self.rex_feature
"katello_package_update"
end

include UnsupportedKatelloAgentCommandHelper
end

class UpgradeAllCommand < HammerCLIKatello::SingleResourceCommand
include HammerCLIForemanTasks::Async
resource :host_packages, :upgrade_all
class UpgradeAllCommand < HammerCLIKatello::Command
command_name "upgrade-all"
success_message "All packages upgraded successfully."
failure_message "Could not upgrade all packages"

build_options

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_update`."
super
def self.rex_feature
"katello_package_update"
end

include UnsupportedKatelloAgentCommandHelper
end

class RemoveCommand < HammerCLIKatello::SingleResourceCommand
include HammerCLIForemanTasks::Async
resource :host_packages, :remove
class RemoveCommand < HammerCLIKatello::Command
command_name "remove"
success_message "Packages removed successfully."
failure_message "Could not remove packages"

validate_options do
option(:option_packages).required
def self.rex_feature
"katello_package_remove"
end

build_options :without => [:groups]

def execute
warn "This command uses katello agent and will be removed in favor of remote execution " \
"in Katello 4.10."
warn "The remote execution equivalent is `hammer job-invocation create --feature " \
"katello_package_remove`."
super
end
include UnsupportedKatelloAgentCommandHelper
end

autoload_subcommands
Expand Down
Loading
Loading