Ask Your Question

How to apply patch to the text file

asked 2014-02-13 02:54:07 -0600

Adam Ryczkowski gravatar image

Sometimes you need to modify certain system scripts with patches (produced by diff).

Theoretically patch-applying mechanism should be quite handy in puppet, but I failed to find anything for "diff" or "patch" on Puppet Forge.

Is it true, that nobody yet did a general-purpose patch-applying puppet module?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-06-05 13:40:01 -0600

Spindizzy gravatar image

There is a module that will apply patches to a file, and a use-case for doing so. It may not have hit the puppet forge until after this question.

The module can be found at:

The use case is a file that is seldom changed by the vendor, but is customized through a GUI by the customer. Occasionally, the vendor must make an addition to the file, in an area not normally touched by the customer, but without damaging the customer's changes if at all possible. One could claim that modifications by the customer are manual operations that the customer is responsible for repeating if the file changes; but our customer is insisting that we not force them to redo work they've already done.

Caveat: I haven't tried the module myself yet. I'll try to remember to come back here and update my answer when I have.

edit flag offensive delete link more

answered 2014-02-13 04:28:18 -0600

doc75 gravatar image

If you manage the file with puppet, you just need to update the file in puppet and puppet will do the diff and apply the modification.

I am afraid that with patch you cannot manage the file properly especially if you bring a new machine that has none of the patch applied.

Puppet philopsphy is to describe as much as possible the targeted machine state and not how to reach this state. Therefore managing the file in puppet is normally the "best" approach.

Hope this helps.

edit flag offensive delete link more


OK. I thought, that when the file is large, it would be more efficient to store patches rather than whole contents. And patches have extra feature that allow to check ...(more)

Adam Ryczkowski gravatar imageAdam Ryczkowski ( 2014-02-13 05:04:37 -0600 )edit

As long as you manage the file with puppet it does not matter if the initial file is compliant or not as it will be overwrittent by puppet. Managing through ...(more)

doc75 gravatar imagedoc75 ( 2014-02-13 06:57:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-02-13 02:54:07 -0600

Seen: 1,476 times

Last updated: Jun 05