Skip to content
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

Update fact to add 30 second timeout; add ifs to restrict lvm commands #158

Merged
merged 1 commit into from
Mar 9, 2017

Conversation

esalberg
Copy link
Contributor

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.

@esalberg
Copy link
Contributor Author

esalberg commented Aug 23, 2016

The rspec tests are still failing despite my attempts. Help please? The functionality appears to be fine (at least, I know that it works with one or more vgs / pvs), so I'm assuming the issue is with the way I tried to update the spec for Facter::Core::Execution, the added option, or the new if statement.

@tphoney
Copy link
Contributor

tphoney commented Nov 23, 2016

Can you please rebase, this is why travisCI maybe failing for this PR. I tested this with #168
apologies for the inconvenience.

…meout: 30 to options hash; add if around vgs and pvs commands to handle F::C::S new management of nil commands; attempt to update spec
@esalberg
Copy link
Contributor Author

Completely missed the update. Rebased.

@esalberg
Copy link
Contributor Author

I am still having rspec issues (same as above) - if someone could take a look and point me in the right direction, that would be great.

@eputnam eputnam merged commit 41a7129 into puppetlabs:master Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants