Closed djjudas21 closed 8 years ago
@djjudas21 is this your fact code? https://github.com/djjudas21/puppet-freeradius/blob/master/lib/facter/freeradius_maj_version.rb
Looking at the code it would seem retrospec is choking on your facter code because it cannot evaluate your code which has conditional logic around the Facter.add block which I have never seen before and would suggest you use a confine statement instead of what your currently doing. Its my understanding that if a fact evaluates to nil that fact is not added. Additionally I think nil is returned if Facter::Core::Execution.exec fails so there doesn't seem to be a need for the conditional block in your code.
About the only thing I can do is just fail with a better message
It it wasn't clean, just remove the condition from your facter code and re-run retrospec and it will generate some fact unit tests for you.
Thanks, that's helpful. Like I said I don't know Ruby well, and I tried to write that fact in a kinda-sorta-Perl way, which is probably a bad idea.
I'm hitting a problem with retrospec. When I run it against a Puppet module that contains custom facts, it does this:
Basic version numbers:
I'm not experienced at writing Ruby. Any hints on debugging this? Thanks.