On Apr 16, 8:22 am, Robert Rothenberg <rob...@gmail.com> wrote:
> So will the setting of the values for $owner and $prefix be deterministic,
> when set inside a class or resource definition?


Manifest code inside a class or definition is processed in lexical
order.

Note also that some programming languages behave similarly to Puppet,
in that their specifications do not require function arguments to be
evaluated in order.  C, for example.


> Also, what if I want to be able to override these with user settings?
> (That's one of the reasons that they are parameters in the first place.)


This is the usual idiom:

class foo(
    $owner,
    $user_prefix  = '',
    $user_etc_dir = ''
   ) {
    $prefix  = $user_prefix ? { '' => "/opt/${owner}", default =>
$user_prefix }
    $etc_dir = $user_etc_dir ? { '' => "${prefix}/etc", default =>
$user_etc_dir }

    ...
 }


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