My experience with using file_line (i use it elsewhere) is that it replaces
the entire line. (maybe this behavior has been changed, we are running
Puppet 3.8). I am looking for a way to substitute a part of the line,
leaving the rest intact.
thanks :)
kevin
On Tue, Apr 9, 2019 at 1:28 AM Dirk Hei
Am Sonntag, den 07.04.2019, 05:47 -0700 schrieb KRouth Clinipace:
Know i will see the other options proposed here
puppetlabs::stdlib -> file_line
Why reinvent the wheel?
Bye...
Dirk
--
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Phone: +49 2226
It looks like what you're trying to do is inline editing of /etc/bashrc,
but still let people poke at it themselves. That's a fragile position to be
in. For example, given your regex solution, what's to stop someone from
doing something like innocently defining their $PS1 iteratively? Something
lik
On 2019-04-07 14:47, KRouth Clinipace wrote:
Question - is it possible to use the puppet regsubst function in place
of the exec used here (to save spawning a new shell process) ?
kevin
Well, functions are ordinary on the compiling side. If you can figure
out what to do when compiling that is
Question - is it possible to use the puppet regsubst function in place of
the exec used here (to save spawning a new shell process) ?
kevin
On Friday, May 21, 2010 at 10:28:58 PM UTC-4, Marley Bacelar wrote:
>
> Nice... I solved my probleman using the:
>
> define replace($file, $pattern, $repla
Nice... I solved my probleman using the:
define replace($file, $pattern, $replacement) {
exec { "/usr/bin/perl -pi -e 's/$pattern/$replacement/' '$file'":
onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if
/$pattern/ && ! /$replacement/ ; END { exit \$ret; }' '$file'",
}
}
> The vast majority of our text replacement work we do is for files that
> have simple key/value pairs with an assignment operator.
>
>
> foo=bar
> foo: bar
>
>
> etc.
>
>
> We occasionally stray outside this with a regexp replacer, but I
> totally agree with Daniel here, it's not the most ro
On Fri, May 21, 2010 at 6:08 PM, Daniel Pittman wrote:
> Marley Bacelar writes:
>
> > I need to replace some text in a file... there is some type, that i can
> pass
> > a value and to be replace and the destination file?
>
> I know this sounds like a great idea, but decades of experience with pu
Marley Bacelar writes:
> I need to replace some text in a file... there is some type, that i can pass
> a value and to be replace and the destination file?
I know this sounds like a great idea, but decades of experience with puppet
and proceeding tools tell us that editing the content of files i
You might want to check out Augeas. It might be easier to use.
I've seen a simple define that does that, but I can't find it. It had a grep
statement in unless, and used sed to make the change. A much more complicated
example can be found at
http://projects.puppetlabs.com/projects/puppet/wik
I need to replace some text in a file... there is some type, that i can pass
a value and to be replace and the destination file? or anyone here have some
class who does that?
--
Marley Bacelar
Project Fedora Ambassador
VCP, VSP. VTSP., ITILF, IBM 000-076, IBM 000-330, IBM 000-331
marleybace...@gm
11 matches
Mail list logo