On Tue, Sep 27, 2011 at 3:55 PM, Douglas Garstang
<[email protected]> wrote:
> On Tue, Sep 27, 2011 at 3:40 PM, Daniel Pittman <[email protected]> wrote:
>> On Tue, Sep 27, 2011 at 15:20, Dan Bode <[email protected]> wrote:
>>> I can think of something really hacky that I don't recommend for production,
>>> it could be ok for debugging purposes.
>>
>> Yeah, this is *totally* not a sane thing to do.  Really not sane.
>> Find a better way to solve your problem.
>>
>> That said, you can also use defined types recursively in Puppet:
>>
>> define foo() {
>>  if ($name == 0) {
>>    notice("done")
>>  }
>>  else
>>  {
>>    notice("bar is $name")
>>    $bar = $name - 1
>>    foo { $bar: }
>>  }
>> }
>>
>> foo { "4": }
>
> Taking that one step further, I tried:
>
>
> define platform::proxy::instance ( $ssl_port ) {
>    if ( $name == 0 ) {
>    } else {
>        $bar = $name - 1
>        $ssl_port = $ssl_port + 1
>        platform::proxy::instance { $bar: ssl_port => $ssl_port }
>    }
> }
>
> platform::proxy::instance { 16: ssl_port => 8557; }
>
> However, this gives the error:
>
> Cannot reassign variable ssl_port at...
>
> *sigh*
>
> Doug.
>

Got it...

define platform::proxy::instance ( $ssl_port ) {
    if ( $name == 0 ) {
    } else {
        $bar = $name - 1
        $ssl_port_in = $ssl_port + 1
        notice ("ssl_port = $ssl_port_in")
        platform::proxy::instance { $bar: ssl_port => $ssl_port_in }
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to