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 29, 2016
1 parent c8b3fd5 commit 2ba9e4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 38 deletions.
6 changes: 4 additions & 2 deletions lib/hammer_cli_katello.rb
Expand Up @@ -22,6 +22,7 @@ def self.exception_handler_class
require 'hammer_cli_katello/i18n'
require "hammer_cli_katello/version"
require 'hammer_cli_katello/id_resolver'
require 'hammer_cli_katello/capsule'

# commands
HammerCLI::MainCommand.lazy_subcommand("activation-key", _("Manipulate activation keys."),
Expand Down Expand Up @@ -97,9 +98,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
47 changes: 11 additions & 36 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,40 +22,12 @@ 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 < HammerCLIKatello::Command
command_name 'content'
desc _('Manage the capsule content')

resource :capsules

class ListLifecycleEnvironmentsCommand < HammerCLIKatello::ListCommand
resource :capsule_content, :lifecycle_environments
command_name 'lifecycle-environments'
Expand Down Expand Up @@ -136,7 +108,10 @@ class SyncCommand < HammerCLIForemanTasks::AsyncCommand
autoload_subcommands
end

autoload_subcommands
HammerCLIForeman::SmartProxy.subcommand(
HammerCLIKatello::Capsule::Content.command_name,
HammerCLIKatello::Capsule::Content.desc,
HammerCLIKatello::Capsule::Content
)
end

end

0 comments on commit 2ba9e4e

Please sign in to comment.