On Jan 27, 4:34 pm, jblaine <cjbla...@gmail.com> wrote:
> Thread back from the dead 5 months later :)
>
> Nan, using your code example, I get this with PE 2.0.1:
>
> err: Could not retrieve catalog from remote server: Error 400 on
> SERVER: Could not match ${ldapclient::params::fileroot}/${name},
> at /etc/puppetlabs/puppet/modules/ldapclient/manifests/config.pp:3
> on node rcf-cm-master.our.org
>
> define ldapclient::conf ($mode, $notify = false) {
>     file { $name:
>         source => ${ldapclient::params::fileroot}/${name},
>         owner => $ldapclient::params::ldapclient_user,
>         mode => $mode,
>         if $notify {
>             notify => Class['ldapclient::service'],
>         }
>         require => Class['ldapclient::install'],
>     }
>
> }
>
> class ldapclient::config {
>     case $sys_sshortai {
>         'RH5': {
>             ldapclient::conf { '/etc/openldap/ldap.conf': mode => '444' }
>             ldapclient::conf { '/etc/ldap.conf': mode => '444' }
>         }
>         'RH6': {
>             ldapclient::conf { '/etc/openldap/ldap.conf': mode => '444' }
>             ldapclient::conf { '/etc/nslcd.conf': mode => '444', notify =
> true }
>         }
>     }
>
> }

Your code looks buggy:
1) you cannot use 'if' statements inside resource defnitions
2) you write "notify = true" where you want "notify => true"

There are a couple of ways to address the former problem, among them
replacing the 'if' block with a selector.  Also, I consider it a
matter of good form to use quotes around strings and to bracket
variable references, so I'd write the definition like this:

define ldapclient::conf ($mode, $notify = false) {
    file { "${name}":
        source => "${ldapclient::params::fileroot}/${name}",
        owner => "${ldapclient::params::ldapclient_user}",
        mode => "${mode}",
        notify => $notify ? { true => Class['ldapclient::service'],
default => undef },
        require => Class['ldapclient::install'],
    }
}


John

-- 
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.

Reply via email to