diff --git a/lib/hammer_cli_katello.rb b/lib/hammer_cli_katello.rb index c92f6a06..11082dee 100644 --- a/lib/hammer_cli_katello.rb +++ b/lib/hammer_cli_katello.rb @@ -24,6 +24,8 @@ def self.exception_handler_class require 'hammer_cli_katello/id_resolver' # commands + require 'hammer_cli_katello/capsule' + HammerCLI::MainCommand.lazy_subcommand("activation-key", _("Manipulate activation keys."), 'HammerCLIKatello::ActivationKeyCommand', 'hammer_cli_katello/activation_key' @@ -97,9 +99,10 @@ def self.exception_handler_class 'hammer_cli_katello/content_view' ) + # Capsule is just an alias to smart proxy HammerCLI::MainCommand.lazy_subcommand("capsule", _("Manipulate capsule"), - 'HammerCLIKatello::Capsule', - 'hammer_cli_katello/capsule' + 'HammerCLIForeman::SmartProxy', + 'hammer_cli_foreman/smart_proxy' ) HammerCLI::MainCommand.lazy_subcommand("package", _("Manipulate packages."), diff --git a/lib/hammer_cli_katello/capsule.rb b/lib/hammer_cli_katello/capsule.rb index dc516814..6c952010 100644 --- a/lib/hammer_cli_katello/capsule.rb +++ b/lib/hammer_cli_katello/capsule.rb @@ -1,7 +1,7 @@ -module HammerCLIKatello - class Capsule < HammerCLIForeman::Command - resource :capsules +require 'hammer_cli_foreman/smart_proxy' +module HammerCLIKatello + module Capsule module LifecycleEnvironmentNameResolvable def lifecycle_environment_resolve_options(options) { @@ -22,39 +22,9 @@ def all_options end end - class ListCommand < HammerCLIKatello::ListCommand - action :index - - output do - field :id, _("Id") - field :name, _("Name") - field :url, _("URL") - end - - build_options - end - - class InfoCommand < HammerCLIKatello::InfoCommand - - action :show - - output ListCommand.output_definition do - field :_features, _("Features"), Fields::List - field :created_at, _("Created at"), Fields::Date - field :updated_at, _("Updated at"), Fields::Date - end - - def extend_data(proxy) - proxy['_features'] = proxy['features'].map { |f| f['name'] } - proxy - end - - build_options - end - - class Content < HammerCLI::AbstractCommand + class Content < HammerCLIForeman::Command command_name 'content' - desc _('Manage the capsule content') + resource :capsules class ListLifecycleEnvironmentsCommand < HammerCLIKatello::ListCommand resource :capsule_content, :lifecycle_environments @@ -136,7 +106,6 @@ class SyncCommand < HammerCLIForemanTasks::AsyncCommand autoload_subcommands end - autoload_subcommands + HammerCLIForeman::SmartProxy.subcommand "content", _('Manage the smart proxy content'), HammerCLIKatello::Capsule::Content end - end