On Thu, 16 Jun 2011 11:56:59 -0400, Guy Matz wrote:
> 
> Hi,
> I'm trying to get the following to work:
> 
> class cluster {
> 
>   $cluster_name = hostname.slice(0..-2)
> .
> .
> } # class
> 
> hoping that if I have a server called appfarmserver1 (obtained from facter,
> can I use a fact like this!?), cluster_name will get set to appfarmserver .
> . .
> 
> puppet --parseonly init.pp says:
> err: Could not parse for environment production: Syntax error at '.';
> expected '}'
> 
> Is there some way to get this to work?  Is there a better, more puppetty way
> to do what I want to do, i.e. based on the hostname from fatcer, set the
> variable cluster_name for use in a template.
> 
> Thanks so much,
> Guy Matz
> 

The most "puppety" way to do it is to create a custom fact that will
return this for you, instead of doing it in the manifest.

You could do it in the manifest using an inline ERB template, but it's
rather hacky.

I definitely recommend going the custom fact route instead.

-- 
Jacob Helwig

Attachment: signature.asc
Description: Digital signature

Reply via email to