Skip to content

Commit

Permalink
Fixes #13614 - Make capsule only an alias to proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Strachota committed Feb 9, 2016
1 parent 5516559 commit 3216416
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 39 deletions.
7 changes: 5 additions & 2 deletions lib/hammer_cli_katello.rb
Expand Up @@ -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'
Expand Down Expand Up @@ -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."),
Expand Down
43 changes: 6 additions & 37 deletions 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)
{
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 3216416

Please sign in to comment.