salt icon indicating copy to clipboard operation
salt copied to clipboard

States "file.append" and "file.accumulated" should have state functions "append_if_not_found" and "prepend_if_not_found" similar to state "file.blockreplace"

Open wongster80 opened this issue 11 years ago • 2 comments

Not sure if this has been already requested but it would be nice to have ths feature request.

wongster80 avatar Dec 12 '14 01:12 wongster80

Thanks for the request @wongster80. file.append's default behavior is to check if the text that will be appended already exists. If it does, it won't append the test. In this case, it seems like adding a append_if_not_found and prepend_if_not_found options would be a bit redundant (append doesn't prepend, only appends). Unless I am misunderstanding what you're requesting - Can you clarify what you mean?

I am not familiar at all with file.accumulated, so I don't know if those options would be useful or not. Maybe @basepi has some thoughts on that.

rallytime avatar Dec 12 '14 17:12 rallytime

I'm with @rallytime -- I don't see the use case for file.append, seems like it's there by default. And I'm not sure you quite understand file.accumulated -- it doesn't actually edit files, it just prepares content for use in a future file.managed state, from what I understand. So I'm not sure these arguments fit for either of the functions you've listed.

basepi avatar Dec 15 '14 22:12 basepi