Chef File Ruby search_file_replace_line in php.ini regex -


i'm trying search existence of following line in file;

default_mimetype = "text/html"

and if found uncommented-out above, comment out so;

;default_mimetype = "text/html"

i have following chef recipe;

ruby_block "php_ini"     block         file = chef::util::fileedit.new("/etc/php.ini")         file.search_file_replace_line(/default_mimetype = "text/html"/, ';default_mimetype = "text/html"')         file.write_file     end end  service "apache2"     action :restart end 

but file_search_replace_line line causing syntax error (probably due "s & ; ) how need write line want?

managing file not recommended, allows kinds of non-convergent behavior , hard reason about. better approach use template resource control content of file, means know in rather depending on happened there before chef ran (usually distro-provided file).

as specifics, issue / in text/html, make text\/html.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -