Jean-Christophe Lacaze / Bintz
2011-Aug-03 09:49 UTC
[Puppet Users] Special character in facter variable
Hello, Im currently trying to get an if condition working. I have: if "$mountpoint_path_my-path" { file with apache privilege } else { file with root privilege } $mountpoint_path_my-path being the facter variable that comes up after something is mounted. I had already that kind of thing working but this time, Im trying to put a path with "-" in it (in my case /var/lib/x-zzz/state). After some tests, the "-" seems to be a problem: if I have it in my path, puppet seems to enter the if condition everytime, even when the directory is not mounted. If I remove it, it works properly and enter the else condition. I tried the following syntaxes, without success: * "$mountpoint_path_my-path" * ''$mountpoint_path_my-path'' * {$mountpoint_path_my-path} * "$mountpoint_path_my\-path" Any clue about a syntax I could use to make this works? Thanks in advance! -- 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.
On 08/03/2011 05:49 AM, Jean-Christophe Lacaze / Bintz wrote:> $mountpoint_path_my-path being the facter variable"${mountpoint_path_my-path}" should work on 2.7.2rc2. Earlier versions of puppet don''t let you have ''-'' in a variable name. Not sure if you are allowed to have a ''-'' in the fact name, but I doubt it. Is this your own fact? How about rewriting it to not have the ''-''? -- vagn -- 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.
Jean-Christophe Lacaze / Bintz
2011-Aug-04 07:30 UTC
[Puppet Users] Re: Special character in facter variable
It''s a fact generated automatically when something is mounted and replace "/" with "_" to generate the fact variable. In my exemple, I have a mountpoint on /var/lib/xxx-yyy/zzz that points to /dev/drbd0 that will translate automatically to a fact named mountpoint_var_lib_xxx-yyy_zzz So the fact includes the "-" since it only translate the path into a variable name. That part seems to work, it''s calling the fact in my class that doesn''t seem to be working. On 3 août, 21:41, vagn scott <vagnsc...@gmail.com> wrote:> On 08/03/2011 05:49 AM, Jean-Christophe Lacaze / Bintz wrote: > > > $mountpoint_path_my-path being the facter variable > > "${mountpoint_path_my-path}" > > should work on 2.7.2rc2. Earlier versions > of puppet don''t let you have ''-'' in a variable > name. Not sure if you are allowed to have > a ''-'' in the fact name, but I doubt it. > Is this your own fact? How about rewriting > it to not have the ''-''? > > -- > vagn-- 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.
vagn scott
2011-Aug-04 09:55 UTC
Re: [Puppet Users] Re: Special character in facter variable
What version of puppet are you on? On 08/04/2011 03:30 AM, Jean-Christophe Lacaze / Bintz wrote:> It''s a fact generated automatically when something is mounted and > replace "/" with "_" to generate the fact variable. > In my exemple, I have a mountpoint on /var/lib/xxx-yyy/zzz that points > to /dev/drbd0 that will translate automatically to a fact named > mountpoint_var_lib_xxx-yyy_zzz > So the fact includes the "-" since it only translate the path into a > variable name. That part seems to work, it''s calling the fact in my > class that doesn''t seem to be working. > > On 3 aoűt, 21:41, vagn scott<vagnsc...@gmail.com> wrote: > >> On 08/03/2011 05:49 AM, Jean-Christophe Lacaze / Bintz wrote: >> >> >>> $mountpoint_path_my-path being the facter variable >>> >> "${mountpoint_path_my-path}" >> >> should work on 2.7.2rc2. Earlier versions >> of puppet don''t let you have ''-'' in a variable >> name. Not sure if you are allowed to have >> a ''-'' in the fact name, but I doubt it. >> Is this your own fact? How about rewriting >> it to not have the ''-''? >> >> -- >> vagn >> >-- 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.
Jean-Christophe Lacaze / Bintz
2011-Aug-04 10:18 UTC
[Puppet Users] Re: Special character in facter variable
Im on a 2.6.1 running on a RedHat EL 5.2 On 4 août, 11:55, vagn scott <vagnsc...@gmail.com> wrote:> What version of puppet are you on? > > On 08/04/2011 03:30 AM, Jean-Christophe Lacaze / Bintz wrote: > > > It''s a fact generated automatically when something is mounted and > > replace "/" with "_" to generate the fact variable. > > In my exemple, I have a mountpoint on /var/lib/xxx-yyy/zzz that points > > to /dev/drbd0 that will translate automatically to a fact named > > mountpoint_var_lib_xxx-yyy_zzz > > So the fact includes the "-" since it only translate the path into a > > variable name. That part seems to work, it''s calling the fact in my > > class that doesn''t seem to be working. > > > On 3 ao t, 21:41, vagn scott<vagnsc...@gmail.com> wrote: > > >> On 08/03/2011 05:49 AM, Jean-Christophe Lacaze / Bintz wrote: > > >>> $mountpoint_path_my-path being the facter variable > > >> "${mountpoint_path_my-path}" > > >> should work on 2.7.2rc2. Earlier versions > >> of puppet don''t let you have ''-'' in a variable > >> name. Not sure if you are allowed to have > >> a ''-'' in the fact name, but I doubt it. > >> Is this your own fact? How about rewriting > >> it to not have the ''-''? > > >> -- > >> vagn-- 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.
vagn scott
2011-Aug-04 10:42 UTC
Re: [Puppet Users] Re: Special character in facter variable
On 08/04/2011 06:18 AM, Jean-Christophe Lacaze / Bintz wrote:> Im on a 2.6.1from http://projects.puppetlabs.com/projects/puppet/wiki/Allowed_Characters_in_Identifier_Names Variables: ¶ <http://projects.puppetlabs.com/projects/puppet/wiki/Allowed_Characters_in_Identifier_Names#Variables> * |[a-zA-Z0-9_]+| (No unicode nonsense or %@^ etc.) * i.e. no hyphens, ever. This was changed in 2.7.2rc2, wheer hyphens are accepted. Can you try that version? --vagn -- 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.
Jean-Christophe Lacaze / Bintz
2011-Aug-04 13:14 UTC
[Puppet Users] Re: Special character in facter variable
No, I can''t update puppet to a new version because we''re running numerous servers with the same configuration. Isn''t there a way to protect the hyphen, something like a "\" ? On 4 août, 12:42, vagn scott <vagnsc...@gmail.com> wrote:> On 08/04/2011 06:18 AM, Jean-Christophe Lacaze / Bintz wrote: > > > Im on a 2.6.1 > > fromhttp://projects.puppetlabs.com/projects/puppet/wiki/Allowed_Character... > > Variables: � > <http://projects.puppetlabs.com/projects/puppet/wiki/Allowed_Character...> > > * |[a-zA-Z0-9_]+| (No unicode nonsense or %@^ etc.) > * i.e. no hyphens, ever. > > This was changed in 2.7.2rc2, wheer hyphens are accepted. > Can you try that version? > > --vagn-- 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.
vagn scott
2011-Aug-04 13:20 UTC
Re: [Puppet Users] Re: Special character in facter variable
On 08/04/2011 09:14 AM, Jean-Christophe Lacaze / Bintz wrote:> Isn''t there a way to protect the hyphenNot that I know of. Have you considered getting rid of the hyphen? Why does your mount have to be xxx-yyy? can''t it be xxx_yyy? Anyway, I''m out of ideas on this. Good luck. -- vagn -- 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.
Jean-Christophe Lacaze / Bintz
2011-Aug-04 13:30 UTC
[Puppet Users] Re: Special character in facter variable
Yeah, I think you''re right. I''ll change the way my mount variable is generated to avoid having a "-" and when possible, upgrade tu 2.7.2 Thanks for the help! On 4 août, 15:20, vagn scott <vagnsc...@gmail.com> wrote:> On 08/04/2011 09:14 AM, Jean-Christophe Lacaze / Bintz wrote: > > > Isn''t there a way to protect the hyphen > > Not that I know of. Have you considered > getting rid of the hyphen? Why does your > mount have to be xxx-yyy? can''t it be xxx_yyy? > > Anyway, I''m out of ideas on this. Good luck. > > -- > vagn-- 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.