-
Notifications
You must be signed in to change notification settings - Fork 24
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
Expose PD sizes, and support older MegaCli binaries. #40
Conversation
I have no objection to supporting older versions of megacli but I dislike attempting to run multiple versions of each command. How about using the |
Another option would be define multiple resolutions for each fact. Eg., https://docs.puppetlabs.com/facter/2.3/custom_facts.html#fact-precedence |
Makes sense - I'll look into the multiple resolution option tomorrow. Thanks! |
Hopefully it's possible to determine the megacli version and have one set of the resolutions bail out before execing. That would minimize the number of times the megacli binary is actually run, which is desirable in my opinion as it can be fairly slow. |
https://docs.puppetlabs.com/facter/2.3/custom_facts.html#confining-facts So I would guess we can likely do that using Puppet's |
My best guess it was 8.02.16 based on the following line from the above:
|
It's not well documented but it is possible to pass a block to confine. https://github.com/puppetlabs/facter/blob/master/lib/facter/util/confine.rb#L17-L19 |
Hah, which was apparently committed by my colleague @dalen. ;) |
It's hard to use puppet without touching @dalen code. :) |
Out of curiosity, why are you restricted to an old version of |
To be quite honest, mostly due to laziness in this instance. We have a whole bunch of tooling built around |
At around version 8.02.16 some arguments to MegaCli changed. This change attempts to determine whether MegaCli is modern (8.02.16 or newer) or legacy (everything else). Facts affected by the changed arguments are gated using a confine statement. This change also handles cases where the MegaCli binary is lowercase (megacli).
PTAL I like this method better, though it does still feel like there's a fair bit of duplication given that a lot of these facts simply run a command, then extract something from the output using a regex. It might be worth factoring all that out into a utility function that takes a command to run and a regex to return on, but I'd like to get this PR merged first if it looks good to you. |
What I had envisioned was constraining the resolution directly based on the |
Expose PD sizes, and support older MegaCli binaries.
@negz This was a huge PR. Thank you for all the effort to get this merged! |
@negz This PR is included in the v2.4.0 release that was just pushed to the forge. Thanks again! |
Awesome, thanks a bunch! P.S. By way of a feature request, it might be nice to move the megacli facts out into a new package. I for one won't actually be using the smartd stuff - I just want to expose some details about our RAID controllers. |
I've been planning to eventually to move the megaraid specific facts into this module https://github.com/jhoblitt/puppet-megaraid but it needs a bit of TLC first. |
I recently had the need to expose the sizes of the physical disks behind the Dell PERCs in our production machines as facts. We're stuck with a fairly old build of MegaCli due to some other tooling dependencies, so I also hacked around a few of the facts to fall back on the older syntax.
Apologies in advance for my horrible Ruby skills. :)