saltstack/salt — pull request #11171 by ze42 (2014-03-12 15:58:26+00:00)
Title: states.file.replace(append/prepend_if_not_found)

Feature just merged for modules.
Straight-forward patch for state file.

Note: not tested yet, but it *looks* simple enough.