Class: Pvectl::Commands::Logs::Handlers::TaskLogs
- Inherits:
-
Object
- Object
- Pvectl::Commands::Logs::Handlers::TaskLogs
- Includes:
- ResourceHandler
- Defined in:
- lib/pvectl/commands/logs/handlers/task_logs.rb
Overview
Handler for VM/CT task history logs.
Resolves VM/CT node via repository, then delegates task listing to Services::TaskListing. With –all-nodes, passes node: nil to the service for cluster-wide iteration.
Constant Summary collapse
- RESOURCE_REPOS =
Maps resource type aliases to repository classes.
{ "vm" => -> { Pvectl::Repositories::Vm }, "vms" => -> { Pvectl::Repositories::Vm }, "ct" => -> { Pvectl::Repositories::Container }, "container" => -> { Pvectl::Repositories::Container }, "containers" => -> { Pvectl::Repositories::Container }, "cts" => -> { Pvectl::Repositories::Container } }.freeze
Instance Method Summary collapse
-
#initialize(task_list_repository: nil, vm_repository: nil, node_repository: nil) ⇒ TaskLogs
constructor
A new instance of TaskLogs.
- #list(vmid:, resource_type: "vm", all_nodes: false, limit: 50, since: nil, until_time: nil, type_filter: nil, status_filter: nil, **_) ⇒ Object
- #presenter ⇒ Object
Constructor Details
#initialize(task_list_repository: nil, vm_repository: nil, node_repository: nil) ⇒ TaskLogs
Returns a new instance of TaskLogs.
33 34 35 36 37 |
# File 'lib/pvectl/commands/logs/handlers/task_logs.rb', line 33 def initialize(task_list_repository: nil, vm_repository: nil, node_repository: nil) @task_list_repository = task_list_repository @vm_repository = vm_repository @node_repository = node_repository end |
Instance Method Details
#list(vmid:, resource_type: "vm", all_nodes: false, limit: 50, since: nil, until_time: nil, type_filter: nil, status_filter: nil, **_) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pvectl/commands/logs/handlers/task_logs.rb', line 39 def list(vmid:, resource_type: "vm", all_nodes: false, limit: 50, since: nil, until_time: nil, type_filter: nil, status_filter: nil, **_) if all_nodes service.list( vmid: vmid, limit: limit, since: since, until_time: until_time, type_filter: type_filter, status_filter: status_filter ) else node = resolve_node(vmid, resource_type) service.list( node: node, vmid: vmid, limit: limit, since: since, until_time: until_time, type_filter: type_filter, status_filter: status_filter ) end end |
#presenter ⇒ Object
57 58 59 |
# File 'lib/pvectl/commands/logs/handlers/task_logs.rb', line 57 def presenter Presenters::TaskEntry.new end |