Re: [Puppet Users] Why IF-ELSE not work?

Felix Frank
Thu, 14 Feb 2013 11:55:44 -0000

Hi,

import is largely deprecated for most uses. I haven''t really used it
after Puppet 0.25.

What I learned back then was that the parser would honor all import
statements it would find. I believe that the if statements cannot be
validated until after the parsing stage, so they won''t hinder
importing.

Instead of relying on import based construct, make sure all your
resources are organized in trees of classes, and that each platform only
*includes* its appropriate tree root.

HTH,
Felix

On 02/14/2013 07:17 AM, Евгений Верещагин wrote:
> I try include different .pp for my systems. site.pp like:
>
> if $operatingsystem == ''debian'' {
>   import ''../my/os/linux/debian.pp''
> }
> elsif $operatingsystem == ''windows'' {
>   import ''../my/os/windows/windows.pp''
> }
> else {
>   import ''../my/os/default/default.pp''
> }
>
> and I try CASE:
>
> case $operatingsystem {
>        redhat: { import ''../my/os/linux/redhat.pp'' }
>        centos: { import ''../my/os/linux/centos.pp'' }
>        windows: { import ''../my/os/windows/windows.pp'' }
>        default: { import ''../my/os/default/default.pp'' }
> }
>
> Why it didn''t work? If I run puppet-agent, it read all pp-files
and
> crash on windows-parameters on Linux or on linux-parameters on Windows.
> What I do incorrect?