sous-chefs / line

Development repository for the line cookbook
https://supermarket.chef.io/cookbooks/line
Apache License 2.0
97 stars 65 forks source link

Only Replace a Line in replace_or_add #38

Closed karcaw closed 7 years ago

karcaw commented 8 years ago

It would be nice if replace_or_add had an option to only replace it matched.

This could be a new LWRP, but may be easier to just add an option to replace_or_add so that if a line is not matched just move on, and not add it at the bottom.

for example: File:

Line 1
Line 2
Line 3

This changes something:

replace_or_add 'file' do
   path '<file>'
  pattern 'Line 2'
  line 'Line Two'
end

But this takes No action:

replace_or_add 'file' do
   path '<file>'
  pattern 'Line 4'
  line 'Line Four'
end
MarkGibbons commented 8 years ago

I can add a replace_only option to replace_or_add very easily.

karcaw commented 8 years ago

Thanks!

someara commented 7 years ago

merged. closing!

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.