Ohad Levy <ohadl...@gmail.com> writes:

> you are right, it seems that type is a reserved word in ruby :(

Just don't try using the variable 'fork' in your templates. ;)

> using another variable name should work.

Theoretically you might be able to use a lookup function to get the value, but
practically it is (sadly) simpler to deal with Ruby being a bit kooky, and
just use a different fact or variable name.

        Daniel

> On Fri, May 28, 2010 at 4:13 PM, Adam Winberg <adam.winb...@gmail.com> wrote:
>
>> ok, interesting!
>> 
>> however i cant make it work:
>> 
>> $my_type = inline_template("<%= type.upcase %>") notify { "type is set to
>> $my_type":; }
>> 
>> and log output on client:
>> 
>> puppetd[13739]: type is set to Notebook
>> 
>> i was expecting to see "NOTEBOOK" there, but no luck. I'm new to puppet and
>> my ruby is rubbish, am i doing something wrong?
>> 
>> //Adam
>> 
>> On 28 May 2010 08:53, Ohad Levy <ohadl...@gmail.com> wrote:
>> 
>>> you can use inline_template to sanitize your values.. e.g.:
>>> 
>>> $my_type = inline_template("<%= type.upcase %>
>>> 
>>> Ohad
>>> 
>>> On Fri, May 28, 2010 at 2:44 PM, Adam Winberg <adam.winb...@gmail.com>
>>> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> facter variables typically have values in lower case. We are looking into
>>>> moving to puppet for our config administration and are currently using a
>>>> system where we do file name matching dependent on specific suffixes - for
>>>> example a file named "*--LAPTOP" will only be deployed on machines tagged
>>>> as laptops.
>>>> 
>>>> I would like to keep this naming convention and observed that facter has a
>>>> "type" variable that on laptops will contain the value "laptop" - but of
>>>> course i want it in upper case for, in my opinion, better clarity. Is
>>>> there some smart way of doing this?
>>>> 
>>>> I guess i could do something like if $type == "laptop" {  $type = "LAPTOP"
>>>> }
>>>> 
>>>> but im looking to see if there is any other smarter ways of doing this.
>>>> 
>>>> Thanks,
>>>> 
>>>> //Adam Winberg
>>>> 
>>>> -- You received this message because you are subscribed to the Google
>>>> Groups "Puppet Users" group.  To post to this group, send email to
>>>> puppet-us...@googlegroups.com.  To unsubscribe from this group, send email
>>>> to puppet-users+unsubscr...@googlegroups.com.  For more options, visit
>>>> this group at http://groups.google.com/group/ puppet-users?hl=en.
>>>> 
>>> -- You received this message because you are subscribed to the Google
>>> Groups "Puppet Users" group.  To post to this group, send email to
>>> puppet-us...@googlegroups.com.  To unsubscribe from this group, send email
>>> to puppet-users+unsubscr...@googlegroups.com.  For more options, visit this
>>> group at http://groups.google.com/group/ puppet-users?hl=en.
>> 
>> -- You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.  To post to this group, send email to
>> puppet-us...@googlegroups.com.  To unsubscribe from this group, send email
>> to puppet-users+unsubscr...@googlegroups.com.  For more options, visit this
>> group at http://groups.google.com/group/puppet-users?hl =en.
>> 

-- 
✣ Daniel Pittman            ✉ dan...@rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to