Class: HammerCLIKatello::ContentViewPurgeCommand
- Inherits:
-
Command
- Object
- HammerCLIForeman::Command
- Command
- HammerCLIKatello::ContentViewPurgeCommand
- Includes:
- HammerCLIForemanTasks::Async, OrganizationOptions
- Defined in:
- lib/hammer_cli_katello/content_view_purge.rb
Instance Method Summary collapse
- #all_options ⇒ Object
- #execute ⇒ Object
- #resource_content_view_versions ⇒ Object
- #resource_content_views ⇒ Object
Methods included from OrganizationOptions
Methods included from ResolverCommons
Instance Method Details
#all_options ⇒ Object
35 36 37 38 39 40 |
# File 'lib/hammer_cli_katello/content_view_purge.rb', line 35 def if super['option_id'].nil? && super['option_name'] super['option_id'] = resolver.content_view_id(super) end super end |
#execute ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/hammer_cli_katello/content_view_purge.rb', line 42 def execute if option_count < 0 output.print_error _("Invalid value for --count option: value must be 0 or greater.") return HammerCLI::EX_USAGE end # Check if there is something to do if option_count >= 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_count) versions_to_purge.each do |v| purge_version(v) end HammerCLI::EX_OK end end |
#resource_content_view_versions ⇒ Object
31 32 33 |
# File 'lib/hammer_cli_katello/content_view_purge.rb', line 31 def resource_content_view_versions HammerCLIForeman.foreman_resource(:content_view_versions) end |
#resource_content_views ⇒ Object
27 28 29 |
# File 'lib/hammer_cli_katello/content_view_purge.rb', line 27 def resource_content_views HammerCLIForeman.foreman_resource(:content_views) end |