more cli: Thread -> pmap. exc2warn
This commit is contained in:
parent
ba7fbed101
commit
9786e145c1
|
@ -27,8 +27,7 @@ def cli_base
|
||||||
node_opt( node).
|
node_opt( node).
|
||||||
each( &push).
|
each( &push).
|
||||||
flat_map {|n| [ n.method(:lxc), n.method(:qemu) ] }.
|
flat_map {|n| [ n.method(:lxc), n.method(:qemu) ] }.
|
||||||
flat_pmap {|m| m.call }.
|
peach {|m| exc2warn( nil) { m.call.each &push } }
|
||||||
each {|n| n.value.each &push }
|
|
||||||
end
|
end
|
||||||
}).
|
}).
|
||||||
opt( :sort, '-s', '--sort=COLUMNS', "Sort by COLUMNs eg hn for host and name ([s]tatus, h[a], [i]d, [n]ame (default), [h]ost, [u]ptime, [c]pu, [m]em, [d]isk)", default: 'n').
|
opt( :sort, '-s', '--sort=COLUMNS', "Sort by COLUMNs eg hn for host and name ([s]tatus, h[a], [i]d, [n]ame (default), [h]ost, [u]ptime, [c]pu, [m]em, [d]isk)", default: 'n').
|
||||||
|
|
|
@ -5,8 +5,8 @@ def cli_qm
|
||||||
connect
|
connect
|
||||||
nodes = Proxmox::Node.all
|
nodes = Proxmox::Node.all
|
||||||
nodes = nodes.select {|n| node == n.name } if node
|
nodes = nodes.select {|n| node == n.name } if node
|
||||||
nodes.flat_map do |n|
|
nodes.flat_pmap do |n|
|
||||||
n.qemu.map {|c| c.vmid.to_i }
|
exc2warn( []) { n.qemu.map {|c| c.vmid.to_i } }
|
||||||
end.sort.each {|c| puts c }
|
end.sort.each {|c| puts c }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +53,7 @@ def cli_qm
|
||||||
|
|
||||||
qm_cli.cmd( :status, "Lists VMs with status", aliases: [nil], &lambda {|target=nil, sort: nil, node: nil, status: nil, tags: nil|
|
qm_cli.cmd( :status, "Lists VMs with status", aliases: [nil], &lambda {|target=nil, sort: nil, node: nil, status: nil, tags: nil|
|
||||||
hosting_table target: target, status: status, sort: sort, tags: tags do |push|
|
hosting_table target: target, status: status, sort: sort, tags: tags do |push|
|
||||||
node_opt( node).lazy.
|
node_opt( node).flat_pmap( &:qemu).peach &push
|
||||||
flat_map {|n| [ Thread.new( n, &:qemu) ] }.
|
|
||||||
each {|n| n.value.each &push }
|
|
||||||
end
|
end
|
||||||
}).
|
}).
|
||||||
opt( :sort, '-s', '--sort=COLUMNS', "Sort by COLUMNs eg hn for host and name ([s]tatus, h[a], [i]d, [n]ame (default), [h]ost, [u]ptime, [c]pu, [m]em, [d]isk)", default: 'n').
|
opt( :sort, '-s', '--sort=COLUMNS', "Sort by COLUMNs eg hn for host and name ([s]tatus, h[a], [i]d, [n]ame (default), [h]ost, [u]ptime, [c]pu, [m]em, [d]isk)", default: 'n').
|
||||||
|
|
Loading…
Reference in a new issue