On Wed, Sep 25, 2013 at 7:59 PM, John Julien <[email protected]> wrote:
> A third option is that an external fact has an optional metadata file >> (myfacts.sh and myfacts.meta). That file can describe things like: >> >> * What facts do you expect to get out of the script >> * What confines the script has >> * Maybe a description of it? >> >> I encountered this same question when I played around with a rewrite of >> facter >> (https://github.com/zaphod42/**facter-rewrite<https://github.com/zaphod42/facter-rewrite>) >> in which everything was an external fact. I didn't implement this, but it >> was what I was thinking of at the time. >> >> The confines can be expressed either as an s-expression style or a small >> language: >> >> { >> "confine": ["and", ["=", "osfamily", "RedHat"], ["=~", >> "kernelversion", "2\.6"]] >> } >> >> Let's just implement this for Linux :) j/k > > This is an interesting proposal. A bit complicated, but as a result very > flexible. If you recall, my main selling point for this enhancement was to > include those who are not as likely to write a fact in Ruby because it is > too complex for them. With that in mind, what are your feelings on a > simplified version of this where we only allow the confine evaluation to be > a collection of fact(s) equalling a specific value. So that might look > like. > myfact.sh > myfact.sh.confine: > {'osfamily': 'RedHat', 'lsbmajdistrelease': 6} > > Agreed, the last thing that is needed is to present a solution that we say is to make things "easier" and then have people start the simple case by having to learn an abstract language expressed in data structures :) How about a hybrid approach: myfacts.sh myfacts.meta where meta can still contain the description, confine, etc. However instead of immediately forcing the author to write s-expressions they can do a simplified version as you propose. That way, we can start with the simple equality matching (that is what a hash as the value of the confine means), and grow to the full expressions (which would be arrays at the value of the confine) if the need arises. > If myfact.sh.confine doesn't exist, we could assume load it. That way > people without hybrid environments don't have to write the same confine > over and over. > > Yep. Any extra file should be optional and sane defaults should be assumed. However, if it is there and does not conform (unknown keys, malformed, whatever), then it should abort the whole run. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/puppet-dev. > For more options, visit https://groups.google.com/groups/opt_out. > -- Andrew Parker [email protected] Freenode: zaphod42 Twitter: @aparker42 Software Developer *Join us at PuppetConf 2014, September 23-24 in San Francisco* -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-dev. For more options, visit https://groups.google.com/groups/opt_out.
