lxc-exporter/lib/lxc_extend.rb

23 lines
457 B
Ruby
Raw Normal View History

2024-01-20 23:22:16 +01:00
require 'lxc'
module LXC
class <<self
def containers &exe
return to_enum __method__ unless block_given?
LXC.
list_containers.
map( &LXC::Container.method( :new)).
each &exe
end
def running_containers &exe
return to_enum __method__ unless block_given?
LXC.
list_containers.
map( &LXC::Container.method( :new)).
select( &:running?).
each &exe
end
end
end