fatbox/salt — comment on commit e640764e2173335fcf6970b3f98e836ab737e1b3
File:  line 0
By fatbox:

I hastily tested this earlier and now with the change now reverted and pushed out to my minions we're back in the original position with greedy regex's reapplying on every state run -- so my macro doesn't really work that well... :)

Since my use case was just removing ldap from the nsswitch line your example with just 'ldap' in before and '' in after works fine, but I still feel like there's a use for being able to say I want to make sure any line that matches my before should be replaced by my after *but* only if the after doesn't already exist. However, I've been looking at the code for the past 10 minutes and can't really see a way to support both use cases without doing something silly like using a parameter to indicate it should only perform the edit if after doesn't exist.

/etc/nsswitch.conf:
file:
- sed
- multiple: false
- limit: "^passwd:"
- before: "passwd:.*"
- after: "passwd:\tfiles"

Thoughts?