I can''t seem to find the erb logic for this? This works: <% if scope.lookupvar("::product_info") =~ /string/ %> hostgroups sting ; hostgroups.cfg <% end %> While this doesn''t: <% if scope.lookupvar("::fqdn") !=~ /string/ %> define service{ use remote-service ; Name of service template to use host_name <%= scope.lookupvar(''::fqdn'') %> service_description NRPE CHECK SERVICE check_command check_nrpe!check_service } <% end %> David Garvey -- 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.
Hi, that would be ''!='' and not ''!=~'' wouldn''t it? Den On 10/11/2011, at 9:02, "david.garvey@gmail.com" <david.garvey@gmail.com> wrote:> I can''t seem to find the erb logic for this? > > This works: > <% if scope.lookupvar("::product_info") =~ /string/ %> > hostgroups sting ; hostgroups.cfg > <% end %> > > While this doesn''t: > <% if scope.lookupvar("::fqdn") !=~ /string/ %> > define service{ > use remote-service ; Name of service template to use > host_name <%= scope.lookupvar(''::fqdn'') %> > service_description NRPE CHECK SERVICE > check_command check_nrpe!check_service > } > <% end %> > > > David Garvey > -- > 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.-- 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.
I''m not a Ruby expert, but shouldn''t it be .... <% if scope.lookupvar("::fqdn") !~ /string/ %> ? - Gonzalo On Thu, Nov 10, 2011 at 9:35 AM, Denmat <tu2bgone@gmail.com> wrote:> Hi, > > that would be ''!='' and not ''!=~'' wouldn''t it? > > Den > > On 10/11/2011, at 9:02, "david.garvey@gmail.com" <david.garvey@gmail.com> > wrote: > > I can''t seem to find the erb logic for this? > > This works: > <% if scope.lookupvar("::product_info") =~ /string/ %> > hostgroups sting ; hostgroups.cfg > <% end %> > > While this doesn''t: > <% if scope.lookupvar("::fqdn") !=~ /string/ %> > define service{ > use remote-service ; Name of service > template to use > host_name <%= scope.lookupvar(''::fqdn'') %> > service_description NRPE CHECK SERVICE > check_command check_nrpe!check_service > } > <% end %> > > > David Garvey > > -- > 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. > > -- > 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. >-- 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.
david.garvey@gmail.com
2011-Nov-09 23:00 UTC
Re: [Puppet Users] if not contains in template
Yep that worked, if scope.lookupvar(''::fqdn'') !~ /string/ Thanks Gonzalo, Dave On Wed, Nov 9, 2011 at 2:45 PM, Gonzalo Servat <gservat@gmail.com> wrote:> I''m not a Ruby expert, but shouldn''t it be .... > > <% if scope.lookupvar("::fqdn") !~ /string/ %> > > ? > > - Gonzalo > > On Thu, Nov 10, 2011 at 9:35 AM, Denmat <tu2bgone@gmail.com> wrote: > >> Hi, >> >> that would be ''!='' and not ''!=~'' wouldn''t it? >> >> Den >> >> On 10/11/2011, at 9:02, "david.garvey@gmail.com" <david.garvey@gmail.com> >> wrote: >> >> I can''t seem to find the erb logic for this? >> >> This works: >> <% if scope.lookupvar("::product_info") =~ /string/ %> >> hostgroups sting ; hostgroups.cfg >> <% end %> >> >> While this doesn''t: >> <% if scope.lookupvar("::fqdn") !=~ /string/ %> >> define service{ >> use remote-service ; Name of service >> template to use >> host_name <%= scope.lookupvar(''::fqdn'') %> >> service_description NRPE CHECK SERVICE >> check_command check_nrpe!check_service >> } >> <% end %> >> >> >> David Garvey >> >> -- >> 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. >> >> -- >> 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. >> > > -- > 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. >-- David Garvey -- 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.