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

Brian Lalor
Thu, 14 Feb 2013 11:55:35 -0000

Import is like a #include in C: it''s essentially a preprocessor
directive and is evaluated before the if/ else.

http://docs.puppetlabs.com/puppet/2.7/reference/lang_import.html

--
Brian Lalor
blalor@bravo5.org

On Feb 14, 2013, at 1:17 AM, Евгений Верещагин <e.vereschagin@gmail.com>
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?
> --
> You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to puppet-users+unsubscribe@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.