I am trying to write a define type which will use an array but in the 
meantime have an argument pass to it that sets a case. See for example :

define link_files ($linkcase) {

   case $linkcase { 
       "var" : {
           file { "${name}_exelink" :
                  path => "/var/log/puppet/${name}_log",
                  ensure => link,
                  target => "/var/log/puppet/${name}_lastlog",
           }
       }
     
      "data" : {
           file { "${name}_exelink" :
                  path => "/var/log/puppet/${name}_log",
                  ensure => link,
                  target => "/var/data/log/puppet/${name}_lastlog",
           }                
       }
    }
}

I would like to use array of names inside manifests.

I tried to call it like this :

$mynamevar = range("node01", "node05")

link_files { '$mynamevar' :
   $linkcase => "var",
}

but it doesn't like it and complains this :
Error 400 on SERVER: Syntax error at 'linkcase'; expected '}'

What should be the correct syntax for this ?

In principle, without the case $linkcase argument one could run the define 
type for an array by using just like,
link_files {$mynamevar :}

Thanks for any suggestion.



                

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/C3bU_P7MPcYJ.
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