On Jul 27, 5:30 pm, jcbollinger <john.bollin...@stjude.org> wrote:
> > Can anyone shed some light on this issue?
>
> I think I can. It doesn't look like you have accurately followed the
> custom fact instructions you referenced. Your custom code should be
> wrapped in "setcode do [...] end", as in the example.
You are correct. The longer recipe I copied from did include the
lines and in my wisdom I figured since I didn't understand them I'd
take them out (: Siimply wrapping the setcode around the code
resolved these issues. Thank you for the gentle explanation.
>
> Also, I think you'll find that your code doesn't do what you want, for
> "/sbin/ifconfig eth0" returns a lot more information than just the
> host's IP address.
>
> Also also, on my linux systems, facter 1.5.6 discerns standard facts
> "ipaddress" and "ipaddress_eth0". Using one of these, you may be able
> to get away without a custom fact at all, instead defining "netname"
> as a standard Puppet variable and initializing it based on one of
> those facts.
Correct, I'll clearly need to improve the code for it to be useful. I
thought I'd try out custom facts and be a bit more clever. What I'm
actually trying to accomplish is simply to have puppet set some
variables in config files on the client (mail relay, ntp server, etc)
differently depending on which network the client sits on (they will
all share a puppet master). It's not clear to me at this point
whether a fact at all is even the right way to do this, or if I should
instead be setting them in variables in a parent node definition and
then using a template in each class that needs to differ, as shown in
a sample recipe for resolv.conf (http://reductivelabs.com/trac/puppet/
wiki/Recipes/ResolvConf).
A worthwhile exercise anyways, I guess the embarrassment of a stupid
question is what I get for diving in without fully understanding
Facter! I remain confused about the error message (non-sh
interpreters sounds to me like it's complaining about the first line,
so I tried all manner of /usr/bin/ruby, /usr/bin/env ruby, simply
commenting with the name as in the example, etc).
At any rate, thanks again!
-Scott
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---