Zane Williamson
2012-Oct-12 00:22 UTC
[Puppet Users] Facter Variable inside of variable string
Hi All, I am using puppet-labs/mysql forge module, but the MySQL package we use is the MySQL-server-community packages. Basically I am need to update a paratmeter $pidfile = ''/var/lib/mysql/${fqdn}.pid'' Where I can put the FQDN into the pidfile variable as suggested above. However it appears I can can''t use Facter variables in strings. I am running on latest 2.7 build for server/agent. Please let me know if you have any suggestions. -Zane -- 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/-/Mla0hn77K48J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Saurabh Bathe
2012-Oct-12 09:53 UTC
Re: [Puppet Users] Facter Variable inside of variable string
On Fri, Oct 12, 2012 at 5:52 AM, Zane Williamson <zane.williamson@gmail.com> wrote:> Hi All, > > I am using puppet-labs/mysql forge module, but the MySQL package we use is > the MySQL-server-community packages. > > Basically I am need to update a paratmeter > > $pidfile = ''/var/lib/mysql/${fqdn}.pid'' >Does putting the string under double quotes work? $pidfile = "/var/lib/mysql/${fqdn}.pid" -- --- Thanks Saurabh Bathe +91 9422785635 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Johan De Wit
2012-Oct-12 10:38 UTC
Re: [Puppet Users] Facter Variable inside of variable string
On 10/12/2012 02:22 AM, Zane Williamson wrote:> Hi All, > > I am using puppet-labs/mysql forge module, but the MySQL package we > use is the MySQL-server-community packages. > > Basically I am need to update a paratmeter > > $pidfile = ''/var/lib/mysql/${fqdn}.pid'' > > Where I can put the FQDN into the pidfile variable as suggested above. > However it appears I can can''t use Facter variables in strings. > > I am running on latest 2.7 build for server/agent. > > Please let me know if you have any suggestions. > > -Zane > -- > 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/-/Mla0hn77K48J. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.http://docs.puppetlabs.com/guides/style_guide.html#quoting use double quotes when you have variables in your string. Grts Jo -- Johan De Wit Open Source Consultant (rhce : 805008667232363) _________________________________________________________ Open-Future Phone +32 (0)2/255 70 70 Zavelstraat 72 Fax +32 (0)2/255 70 71 3071 KORTENBERG Mobile +32 (0)474/42 40 73 BELGIUM http://www.open-future.be _________________________________________________________ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Garrett Honeycutt
2012-Oct-12 11:13 UTC
Re: [Puppet Users] Facter Variable inside of variable string
On 10/12/12 12:38 PM, Johan De Wit wrote:> On 10/12/2012 02:22 AM, Zane Williamson wrote: >> Hi All, >> >> I am using puppet-labs/mysql forge module, but the MySQL package we >> use is the MySQL-server-community packages. >> >> Basically I am need to update a paratmeter >> >> $pidfile = ''/var/lib/mysql/${fqdn}.pid'' >> >> Where I can put the FQDN into the pidfile variable as suggested above. >> However it appears I can can''t use Facter variables in strings. >> >> I am running on latest 2.7 build for server/agent. >> >> Please let me know if you have any suggestions. >> >> -Zane >> -- >> 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/-/Mla0hn77K48J. >> To post to this group, send email to puppet-users@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. > http://docs.puppetlabs.com/guides/style_guide.html#quoting > > use double quotes when you have variables in your string. > > Grts > > Jo >Here''s a link[1] to what Johan mentioned. Facts should also be fully scoped. Notice the :: before the facter variable in the code below. $localvar = ''somevalue'' $string = "${::fqdn}-${localvar}" [1] - http://docs.puppetlabs.com/guides/language_guide.html#variable-interpolation-with-quotes -g -- Garrett Honeycutt 206.414.8658 http://puppetlabs.com -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.