Class: OsCtld::Commands::Repository::ImageList
- Defined in:
- lib/osctld/commands/repository/image_list.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #client_handler, #id, #opts
Instance Method Summary collapse
- #execute ⇒ Object
- #filter(t) ⇒ 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 |
# File 'lib/osctld/commands/repository/image_list.rb', line 7 def execute repo = DB::Repositories.find(opts[:name], opts[:pool]) error!('repository not found') unless repo osctl_repo = OsCtlRepo.new(repo) ok(osctl_repo.list_images.select(&method(:filter)).map(&:dump)) end |
#filter(t) ⇒ Object (protected)
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/osctld/commands/repository/image_list.rb', line 18 def filter(t) %i[vendor variant arch distribution version].each do |v| return false if opts[v] && opts[v] != t.send(v) end return false if opts[:tag] && !t..include?(opts[:tag]) return false if opts[:cached] === true && !t.cached? return false if opts[:cached] === false && t.cached? true end |