forcing a variable to be lower case?

37 views
Skip to first unread message

Peter Berghold

unread,
Feb 25, 2015, 2:27:00 PM2/25/15
to puppet-users
I have a situation where there is an uppercase letter in a client's host name. When Puppet creates the certificate for the host the resultant name for the is in all lower case as I'd expect.

The trouble comes in where I am managing the /etc/puppet/puppet.conf file. In my template I have 
            certname = <%= certname %>

and in my class I have certname defined as 

             $certname = downcase("$fqdn")

This is not working.  How should I attack this? 

Peter Bukowinski

unread,
Feb 25, 2015, 3:20:14 PM2/25/15
to puppet...@googlegroups.com
Since templates let you use normal ruby functions, I would do your downcasing in there:

certname = <% certname.downcase %>

--
Peter

Peter Bukowinski

unread,
Feb 25, 2015, 3:21:24 PM2/25/15
to puppet...@googlegroups.com
Correction:

certname = <%= certname.downcase %>

Peter Berghold

unread,
Feb 25, 2015, 3:56:15 PM2/25/15
to puppet...@googlegroups.com
Thank you!  That got it.  Why it "didn't work" before I'm not sure. On to my next "dumb question."


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/DB8C41A8-AA82-4769-83C5-7B0D19AC7CBE%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages