puppet - Conditional logic on whether to include subclass -
puppet - Conditional logic on whether to include subclass -
i'm trying edit init.pp file include subclass if variable has been set. i've initialized variables undef, when if statement below errors , says:
syntax error @ 'if'; expected '}'
when write case statement, works fine not if. thought why is?
class {'wlsvr': } -> case $jdbc_filename { undef: {} default: {class {'jdbc':}} } -> if $managedsvr_name != undef { class {'managedsvr': } }
please rid of unfortunate habit of using
->
between every other puppet statement.
this chainging arrow introduces dependency between resources/classes connects. should used when dependency needed. issues opening to
gratuitous dependency trees when building dependencies between classes (you here) issues when refactoring code, becauseif
, cases
statements not (always) form equivalent of resources or classes as aside, beneficial avoid the
class { 'classname': }
syntax declaring classes , prefer
include classname
instead, because former costs singleton semantics of puppet classes.
puppet
Comments
Post a Comment