-
Notifications
You must be signed in to change notification settings - Fork 37
Get pool data however the state (resp. status) #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Get pool data however the state (resp. status) #55
Conversation
983c294
to
7621c23
Compare
lib/puppet/provider/zpool/zpool.rb
Outdated
zpool_data = out.lines.select { |line| line.index("\t") == 0 }.map { |l| l.strip.split("\s")[0] } | ||
zpool_data.shift | ||
out = execute("zpool iostat -v #{zpool_opts} #{@resource[:pool]}", failonfail: false, combine: false) | ||
zpool_data = out.lines[3..-2].map { |line| line.strip.split("\s")[0] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails on Solaris 11 since the last separator is included because of an empty line at the end of the command.
This commits substitutes 'zpool iostat' for 'zpool status' to fix improper parsing due to the variety of states and statuses.
7621c23
to
c070269
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that these changes work for my case with Solaris 11.
Update: does not work if zpool is missing:
# zpool iostat -d test
cannot open 'test': no such pool
this leads to undefined method `map' for nil:NilClass
This commit substitutes 'zpool iostat' for 'zpool status' to fix improper parsing due to the variety of states and statuses.