Class: HammerCLIKatello::ContentViewPurgeCommand
- Inherits:
-
Command
- Object
- HammerCLIForeman::Command
- Command
- HammerCLIKatello::ContentViewPurgeCommand
- Includes:
- HammerCLIForemanTasks::Async, ApipieHelper, OrganizationOptions
- Defined in:
- lib/hammer_cli_katello/content_view_purge.rb
Defined Under Namespace
Classes: ContentViewIdParamSource
Instance Method Summary collapse
Methods included from OrganizationOptions
Methods included from ApipieHelper
#call, #destroy, #index, #show, #update
Methods included from ResolverCommons
Instance Method Details
#execute ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/hammer_cli_katello/content_view_purge.rb', line 53 def execute ['option_versions_to_keep'] = option_versions_to_keep if option_versions_to_keep.negative? output.print_error _("Invalid value for --versions-to-keep: value must be 0 or greater.") return HammerCLI::EX_USAGE end # Check if there is something to do if option_count warn _("The --count option is deprecated and will be removed in the next release.") ['option_versions_to_keep'] = option_count end if ['option_versions_to_keep'] >= old_unused_versions.size output.print_error _("No versions to delete.") HammerCLI::EX_NOT_FOUND else versions_to_purge = old_unused_versions.slice(0, old_unused_versions.size - ['option_versions_to_keep']) versions_to_purge.each do |v| purge_version(v) end HammerCLI::EX_OK end end |
#option_sources ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/hammer_cli_katello/content_view_purge.rb', line 43 def option_sources sources = super sources.find_by_name('IdResolution').insert_relative( :after, 'IdParams', ContentViewIdParamSource.new(self) ) sources end |