saltstack/salt — pull request #4404 by basepi (2013-04-05 23:59:28+00:00)
Title: Rewrite "success" requirements for file.sed

Fixes #4353

We no longer do any checking with regard to the `after` pattern. If the `before` pattern is not present, then we return `True`, because we assume the edit has either been made previously, or does not need to be made.

If the `before` pattern is present, we run the `sed` command, creating a diff of the file before and after. If the file changed, we return `True` and the diff. If the file remained the same, we return `False`.

I'm still not completely on board with using `sed` to manage state, but this should make it much more reasonable/robust (backreferences work now!).