Skip to content
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
65 changes: 0 additions & 65 deletions lib/hammer_cli_katello/activation_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,71 +176,6 @@ class DeleteCommand < HammerCLIKatello::DeleteCommand
build_options
end

class SubscriptionsCommand < HammerCLIKatello::ListCommand
resource :subscriptions, :index
desc _("List associated subscriptions")
command_name "subscriptions"

output do
field :id, _("Id")
field :product_name, _("Name")
field :format_consumed, _("Attached")
field :quantity_attached, _("Quantity")
field :start_date, _("Start Date"), Fields::Date
field :end_date, _("End Date"), Fields::Date
field :support_level, _("Support")
field :contract_number, _("Contract")
field :account_number, _("Account")
end

def extend_data(data)
data["format_consumed"] = _("#{data['consumed']} out of "\
"#{data['quantity'] == -1 ? 'Unlimited' : data['quantity']}")
data
end

option '--id', "ACTIVATION_KEY_ID", _("ID of the activation key"),
attribute_name: :option_activation_key_id
option '--name', "ACTIVATION_KEY_NAME", _("Activation key name to search by"),
attribute_name: :option_activation_key_name

validate_options :before, 'IdResolution' do
any(:option_activation_key_id, :option_activation_key_name).required
end

build_options
end

class AddSubscriptionsCommand < HammerCLIKatello::SingleResourceCommand
action :add_subscriptions

desc "Add subscription"
command_name "add-subscription"

build_options

success_message _("Subscription added to activation key.")
failure_message _("Could not add subscription to activation key")
end

class RemoveSubscriptionCommand < HammerCLIKatello::SingleResourceCommand
action :remove_subscriptions

desc _("Remove subscription")
command_name "remove-subscription"

option "--subscription-id", "SUBSCRIPTION_ID", _("ID of subscription"),
:attribute_name => :option_subscription_id, :required => true

build_options do |o|
o.expand.except(:subscriptions)
o.without(:subscriptions)
end

success_message _("Subscription removed from activation key.")
failure_message _("Could not remove subscription from activation key")
end

class ProductContentCommand < HammerCLIKatello::ProductContentBase::ProductContentCommand
resource :activation_keys, :product_content
setup
Expand Down
1 change: 0 additions & 1 deletion lib/hammer_cli_katello/host_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ module HostExtensions
field :uuid, _('Uuid')
field :last_checkin, _('Last Checkin')
field :release_version, _('Release Version')
field :autoheal, _('Autoheal')
field :registered_through, _('Registered To')
field :registered_at, _('Registered At')
collection :activation_keys, _('Registered by Activation Keys'), :hide_blank => true do
Expand Down
65 changes: 0 additions & 65 deletions lib/hammer_cli_katello/host_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,71 +32,6 @@ class CreateCommand < HammerCLIKatello::SingleResourceCommand
extend_with(HammerCLIKatello::CommandExtensions::LifecycleEnvironment.new)
end

class AddSubscriptions < HammerCLIKatello::SingleResourceCommand
resource :host_subscriptions, :add_subscriptions
command_name "attach"
success_message _("Subscription attached to the host successfully.")
failure_message _("Failed to attach subscriptions to the host")

option "--subscription-id", "SUBSCRIPTION_ID", _("ID of subscription"),
:attribute_name => :option_subscription_id, :required => true

option "--quantity", "Quantity", _("Quantity of this subscriptions to add. Defaults to 1"),
:attribute_name => :option_quantity, :required => false

def request_params
params = super
params[:subscriptions] = [
{
:id => option_subscription_id,
:quantity => option_quantity || 1
}
]
params
end

build_options do |o|
o.expand.except(:subscriptions)
o.without(:subscriptions)
end
end

class AutoAttachSubscriptions < HammerCLIKatello::SingleResourceCommand
resource :host_subscriptions, :auto_attach
command_name "auto-attach"
success_message _("Auto attached subscriptions to the host successfully.")
failure_message _("Failed to auto attach subscriptions to the host")

build_options
end

class RemoveSubscriptions < HammerCLIKatello::SingleResourceCommand
resource :host_subscriptions, :remove_subscriptions
command_name "remove"
success_message _("Subscription removed from the host successfully.")
failure_message _("Failed to remove subscriptions from the host")

option "--subscription-id", "SUBSCRIPTION_ID", _("ID of subscription"),
:attribute_name => :option_subscription_id, :required => true

option "--quantity", "Quantity",
_("Remove the first instance of a subscription with matching id and quantity"),
:attribute_name => :option_quantity, :required => false

def request_params
params = super
subs = { :id => option_subscription_id }
subs[:quantity] = option_quantity if option_quantity
params[:subscriptions] = [subs]
params
end

build_options do |o|
o.expand.except(:subscriptions)
o.without(:subscriptions)
end
end

class ProductContentCommand < HammerCLIKatello::ProductContentBase::ProductContentCommand
resource :host_subscriptions, :product_content
setup
Expand Down
74 changes: 0 additions & 74 deletions test/functional/activation_key/subscriptions_test.rb

This file was deleted.

3 changes: 0 additions & 3 deletions test/functional/host/extensions/data/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@
"model_name":"Standard PC (i440FX + PIIX, 1996)",
"errata_status":1,
"errata_status_label":"Could not calculate errata status, ensure host is registered and katello-agent is installed",
"subscription_status":0,
"subscription_status_label":"Fully entitled",
"name":"robot.example.com",
"id":1,
"hostgroup_name":null,
Expand Down Expand Up @@ -117,7 +115,6 @@
"release_version":"7Server",
"purpose_usage":"Production",
"purpose_role":"Role",
"autoheal":true,
"registered_at":"2016-05-26 10:46:22 -0400",
"activation_keys":[

Expand Down
3 changes: 0 additions & 3 deletions test/functional/host/extensions/data/host_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
"model_name":"Standard PC (i440FX + PIIX, 1996)",
"errata_status":1,
"errata_status_label":"Could not calculate errata status, ensure host is registered and katello-agent is installed",
"subscription_status":0,
"subscription_status_label":"Fully entitled",
"traces_status":0,
"traces_status_label":"updated",
"name":"robot.example.com",
Expand Down Expand Up @@ -137,7 +135,6 @@
"last_checkin":"2016-05-26 10:46:18 -0400",
"service_level":null,
"release_version":"{\"releaseVer\"=>nil}",
"autoheal":true,
"registered_at":"2016-05-26 10:46:22 -0400"
},
"content_host_id":2
Expand Down
54 changes: 0 additions & 54 deletions test/functional/host/subscription/attach_test.rb

This file was deleted.

35 changes: 0 additions & 35 deletions test/functional/host/subscription/auto_attach_test.rb

This file was deleted.

Loading