나는 많은 답변과 해결 된 것들이 있지만 나에게는 효과가없는 것으로 알고있다. 내가하고 싶은 것은 바람둥이가 설치 완료된 후 몇 줄의 코드를 추가하고 싶다는 것이다. /var/lib/tomcat8/conf/catalina.properties 파일에 있습니다.요리사를 사용하여 파일 편집
여기 제가 지금까지 단순한 루비 방법과 요리사 유틸리티와 함께 시도한 것입니다.
File.open("/var/lib/tomcat8/conf/catalina.properties", "a+") do |f|
f << "\n"
f << "javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"
end
ruby_block "insert_line" do
block do
file = Chef::Util::FileEdit.new("/var/lib/tomcat8/conf/catalina.properties")
file.insert_line_if_no_match("/javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl/", "javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl")
file.write_file
end
end
file '/var/lib/tomcat8/conf/catalina.properties' do
action :create
owner 'root'
group 'root'
content File.open("/var/lib/tomcat8/conf/catalina.properties", "a+") do |f|
f << "\n"
f << "javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"
end
end
file '/var/lib/tomcat8/conf/catalina.properties' do
action :create
owner 'root'
group 'root'
content File.open("/var/lib/tomcat8/conf/catalina.properties", "a+") do |f|
f << "\n"
f << "javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"
end
end
puts "testing"을 넣으려고했는데 요리사가 코드에 익숙해 보이지 않는 것 같습니다.