Class: Pvectl::Commands::Get::Handlers::Capabilities
- Inherits:
-
Object
- Object
- Pvectl::Commands::Get::Handlers::Capabilities
- Includes:
- ResourceHandler
- Defined in:
- lib/pvectl/commands/get/handlers/capabilities.rb
Overview
Handler for ‘pvectl get node-capabilities`.
Surfaces what features a node supports — primarily the available QEMU CPU models and machine types. When ‘–node` is provided the query is scoped to that node; otherwise the handler iterates all online nodes and aggregates the results, silently skipping unreachable nodes (matches the pattern used by the time handler).
Instance Method Summary collapse
-
#initialize(repository: nil, node_repository: nil) ⇒ Capabilities
constructor
A new instance of Capabilities.
-
#list(node: nil, name: nil, args: [], storage: nil, **_options) ⇒ Array<Models::Capability>
Lists capabilities, optionally scoped to a node.
-
#presenter ⇒ Presenters::Capability
Returns the capability presenter.
Methods included from ResourceHandler
Constructor Details
#initialize(repository: nil, node_repository: nil) ⇒ Capabilities
Returns a new instance of Capabilities.
23 24 25 26 |
# File 'lib/pvectl/commands/get/handlers/capabilities.rb', line 23 def initialize(repository: nil, node_repository: nil) @repository = repository @node_repository = node_repository end |
Instance Method Details
#list(node: nil, name: nil, args: [], storage: nil, **_options) ⇒ Array<Models::Capability>
Lists capabilities, optionally scoped to a node.
36 37 38 39 40 41 42 43 44 |
# File 'lib/pvectl/commands/get/handlers/capabilities.rb', line 36 def list(node: nil, name: nil, args: [], storage: nil, **) return fetch_for(node) if node online_node_names.flat_map do |node_name| repository.list(node: node_name) rescue StandardError [] end end |
#presenter ⇒ Presenters::Capability
Returns the capability presenter.
49 50 51 |
# File 'lib/pvectl/commands/get/handlers/capabilities.rb', line 49 def presenter Pvectl::Presenters::Capability.new end |