Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/puppet/provider/zpool/zpool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ def get_pool_data
''
end
out = execute("zpool status #{zpool_opts} #{@resource[:pool]}", failonfail: false, combine: false)
zpool_data = out.lines.select { |line| line.index("\t") == 0 }.map { |l| l.strip.split("\s")[0] }
lines = out.lines
# Skip until we reach the NAME/STATE/READ/WRITE/CKSUM header
lines = lines.drop_while { |l| !(l =~ /^\s*NAME\s+STATE\s+READ\s+WRITE\s+CKSUM/) }
# Now collect indented table rows (pool and vdevs)
zpool_data = lines
.select { |l| l =~ /^\s+/ }
.map { |l| l.strip.split(/\s+/)[0] }
# Drop the "NAME" header
zpool_data.shift
zpool_data
end
Expand Down