Update fact to add 30 second timeout; add ifs to restrict lvm commands #158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a followup to here:
#98
I figured it was worth putting in a new request versus reopening the old one. I'd still like to get a timeout on a couple of the facts so that facter will return / doesn't hang on nodes with an underlying disk issue.
There appear to be two versions of valid syntax for the timeout - I used the first but I'm happy to rewrite with the second if preferred.
( [...] ,options = {:timeout => 30})
( [...] ,timeout: 30)
I set the timeout to 30 as a generic value, but I'm happy to adjust. I still wasn't sure how to pass a value from the Puppet code into the custom fact, but if I can get a pointer on that, I'd be happy to make that change as well.
I also added if statements around the lvm commands - because they are not in setcode blocks, the confines listed don't actually apply to them, and with Facter::Core::Execution being used to set the timeout, the error about the missing command now shows up (versus the different way it was handled with Facter::Util::Resolution).
Truthfully, the fact might benefit from being rewritten to be structured (at least add a Facter array for the vg_list and pv_list arrays that are used in the Ruby code) - I started down that path, but my Ruby / rspec isn't the strongest and I figured I'd do a quick patch for now and let someone else tackle a full refactor.