Re: [Puppet Users] How to check a text file for a certain line?

2014-04-22 Thread Joachim Schrod
On 04/22/14 01:41, Kenton Brede wrote:
 On Mon, Apr 21, 2014 at 5:53 PM, Andreas Ntaflos
 d...@pseudoterminal.org mailto:d...@pseudoterminal.org wrote:
 
 On 2014-04-22 00:10, Joachim Schrod wrote:
  On 04/21/14 19:42, Kenton Brede wrote:
  Look into using file_line, it's part of stdlib.
 
  https://forge.puppetlabs.com/puppetlabs/stdlib
 
  Hmm, I don't detect any documentation of file_line at that URL.
 
  Could you post another link with documentation?
 
 Funny that it doesn't seem to be mentioned in the README
 anymore, but
 here is the code and the documentation:
 
 
 https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/file_line.rb
 
 Click on the types tab on that page and you'll see the
 documentation for file_line.

Thanks to both of you for that pointers; I'm still new to puppet
and need to find my way around.

Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/lj5ac7%24i28%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] How to check a text file for a certain line?

2014-04-21 Thread Dan Pasacrita
Hi everyone, I'm pretty new to puppet, and I was wondering if you guys to 
help me with something pretty basic. I'm attempting to write a module that 
will check a text file for a certain line of text, and if it doesn't find 
it, to add a that content in a new line.

I'm pretty sure I can add the new line using exec to run echo content  
file.txt, but checking the file for said content has me completely stumped. 
What can I do here?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ff5d0baa-7adc-4162-983a-67bb010a3fb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to check a text file for a certain line?

2014-04-21 Thread Steven Kurylo
On Mon, Apr 21, 2014 at 8:18 AM, Dan Pasacrita whitewind...@gmail.comwrote:

 Hi everyone, I'm pretty new to puppet, and I was wondering if you guys to
 help me with something pretty basic. I'm attempting to write a module that
 will check a text file for a certain line of text, and if it doesn't find
 it, to add a that content in a new line.


You want to use unless in your exec
http://docs.puppetlabs.com/references/latest/type.html#exec

Here are some example of what you're trying to accomplish:

http://projects.puppetlabs.com/projects/puppet/wiki/Simple_Text_Patterns/5

exec { /bin/echo '${line}'  '${file}':
unless = /bin/grep -qFx '${line}' '${file}'
}

-- 
Steven KuryƂo

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMd2BmOaFSpafcxXZkJcTrrsfZreu55GKadFEz0VyA5KYu%2BUMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to check a text file for a certain line?

2014-04-21 Thread Joachim Schrod
On 04/21/14 19:42, Kenton Brede wrote:
 Look into using file_line, it's part of stdlib.
 
 https://forge.puppetlabs.com/puppetlabs/stdlib

Hmm, I don't detect any documentation of file_line at that URL.

Could you post another link with documentation?

Thanks,
Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/lj450h%24glh%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] How to check a text file for a certain line?

2014-04-21 Thread Andreas Ntaflos
On 2014-04-22 00:10, Joachim Schrod wrote:
 On 04/21/14 19:42, Kenton Brede wrote:
 Look into using file_line, it's part of stdlib.

 https://forge.puppetlabs.com/puppetlabs/stdlib
 
 Hmm, I don't detect any documentation of file_line at that URL.
 
 Could you post another link with documentation?

Funny that it doesn't seem to be mentioned in the README anymore, but
here is the code and the documentation:

https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/file_line.rb

Andreas



signature.asc
Description: OpenPGP digital signature


Re: [Puppet Users] How to check a text file for a certain line?

2014-04-21 Thread Kenton Brede
Click on the types tab on that page and you'll see the documentation for
file_line.
Kent


On Mon, Apr 21, 2014 at 5:53 PM, Andreas Ntaflos d...@pseudoterminal.orgwrote:

 On 2014-04-22 00:10, Joachim Schrod wrote:
  On 04/21/14 19:42, Kenton Brede wrote:
  Look into using file_line, it's part of stdlib.
 
  https://forge.puppetlabs.com/puppetlabs/stdlib
 
  Hmm, I don't detect any documentation of file_line at that URL.
 
  Could you post another link with documentation?

 Funny that it doesn't seem to be mentioned in the README anymore, but
 here is the code and the documentation:


 https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/file_line.rb

 Andreas




-- 
Kent Brede

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE38vtL0_JVfBX3dnPhLv%3DiFF98_L-nAZu7nxjyibZWjf8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.