Class: OsCtld::Commands::Repository::ImagePrune
- Defined in:
- lib/osctld/commands/repository/image_prune.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #client_handler, #id, #opts
Instance Method Summary collapse
- #execute ⇒ Object
- #repositories ⇒ Object protected
Methods inherited from Base
#base_execute, #call_cmd, #call_cmd!, #error, #error!, handle, #handled, #indirect?, #initialize, #manipulate, #manipulation_holder, #ok, #progress, #request_stop, run, run!
Constructor Details
This class inherits a constructor from OsCtld::Commands::Base
Instance Method Details
#execute ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/osctld/commands/repository/image_prune.rb', line 7 def execute repositories.each do |repo| status, files = repo.prune_images(older_than_days: opts[:older_than_days]) error!("failed to prune repository #{repo.ident}") unless status files.each do |file| progress("Deleted #{file}") end end ok end |
#repositories ⇒ Object (protected)
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/osctld/commands/repository/image_prune.rb', line 22 def repositories if opts[:repositories]&.any? opts[:repositories].map do |name| DB::Repositories.find(name, opts[:pool]) || error!("repository #{name} not found") end elsif opts[:pool] DB::Repositories.get.select { |repo| repo.pool.name == opts[:pool] } else DB::Repositories.get end end |