On Nov 21, 7:55 am, Nick <oinksoc...@letterboxes.org> wrote:
> A problem I've run into during my first attempts at writing manifests, is
> knowing what possible facts are available, and for a given fact, what values 
> my
> manifest might encounter.

I use 'default' matches liberally. For required values I throw an
error or warning where a value isn't found. Usually you can set a sane
default inside the resource[1]:
file { 'sshdconfig':
    name => $operatingsystem ? {
        solaris => '/usr/local/etc/ssh/sshd_config',
        default => '/etc/ssh/sshd_config',
    },
}

Or when the value must be known to get a functional catalog:
class foo::client {
    case $operatingsystem {
        'redhat':   { include foo::client::redhat }
        'solaris':  { include foo::client::solaris }
        default:    { fail( "unsupported operatingsystem
\"$operatingsystem\" ")}
    }
}

> Of course, I know that not all facts can be enumerated, but I had expected 
> there
> be a catalog of common facts and their values somewhere, but there seems not 
> to
> be.  The Facter page [1] and API documentation [2] give rather scanty
> information about anything, yet alone list any values.  Ultimately I've been
> forced to search out the source code and infer the values from that.

I'd suggest opening a ticket for the documentation. I think puppetlabs
is making a push to improve the docs, but need tickets to prioritize
work.

> Then there is the question of how consistent the list of facts and their 
> values
> are from version to version of Puppet/Facter. That is even harder to discover
> from the source code.

I've been using puppet since .22 and I can't recall any facts changing
drastically. Usually its simply facts expanding to resolve more
accurate data.

[1] http://docs.puppetlabs.com/guides/language_tutorial.html

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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.

Reply via email to