vicki
2012-Mar-26 22:34 UTC
[Puppet Users] can puppet check if the string is present in file
Hello, I need to add the JVM arguments to the script based on some condition. First I need to check whether the string representing these args is already there. Can Puppet check the existence a substring and return with a code just like java indexOf(substr) does? Thank you. Vicki -- 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.
Gary Larizza
2012-Mar-26 22:44 UTC
Re: [Puppet Users] can puppet check if the string is present in file
Look at the ''file_line'' custom type in the Puppetlabs Stdlib. The documentation in the file should assist with its usage. https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/file_line.rb On Monday, March 26, 2012, vicki <vickikozel@gmail.com> wrote:> Hello, > I need to add the JVM arguments to the script based on some condition. > First I need to check whether the string representing these args is > already there. Can Puppet check the existence a substring and return > with a code just like java indexOf(substr) does? > > Thank you. > Vicki > > -- > 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 topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en.> >-- Gary Larizza Professional Services Engineer Puppet Labs -- 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.
vicki
2012-Mar-26 23:40 UTC
[Puppet Users] Re: can puppet check if the string is present in file
Thank you Gary for your reply. It is actually the substring of the line that I have to check. Here''s the sed command that I use: sed ''s/^JVM_OPTS=\"/&\-Xbootclasspath\/p\:\/eng\/x.jar <sed_test.sh>sed_test_new.shAs you can see, I am matching this substring *JVM_OPTS+"* at the beginning of the JVM_OPTS line in the script, and inserting my bootclasspath argument right after. I am going to look at your code, and see if I can either get it to work for my case, or come up with something that works. Thanks!! Vicki On Monday, March 26, 2012 3:34:21 PM UTC-7, vicki wrote:> > Hello, > I need to add the JVM arguments to the script based on some condition. > First I need to check whether the string representing these args is > already there. Can Puppet check the existence a substring and return > with a code just like java indexOf(substr) does? > > Thank you. > Vicki-- 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/-/U9yr46xclUwJ. 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.