【发布时间】:2018-06-21 22:32:27
【问题描述】:
是否可以使用厨师食谱维护文件中的特定行。
示例:fileA.txt
foo
foofoofoo
This is important content
This is important content
fooo
foofoofoof
foooooofoofofofof
在上面的示例中,我有一个名称 fileA.txt 有两行重要的行,这对我来说非常重要。如果有人只更改文件中的这两行。下次运行 chef-client 将其恢复到相同的状态。
但是如果有人更改了其他对我不重要的行,它不会将其还原。
file '/tmp/fileA.txt' do
content 'foo
foofoofoo
This is important content
This is important content
fooo
foofoofoo
foooooofoofofofof'
action :create
end
上面的代码也恢复了我不想要的其他行.. 有什么解决办法吗?
【问题讨论】: