How to edit file in chef cookbook after it's creation with bash -


i'm writing chef recipe app deployment. i'm extracting code , editing it. looks like:

bash 'admin-init'     user "root"     code <<-eoh         <here extract code>     eoh end  execute 'configure'   file = chef::util::fileedit.new(node["code_dir"] + "websaas/settings.py")   file.search_file_replace("'host': '*'", "'host': '" + node["db_host"] + "'")   file.write_file end 

my problem during compilation, settings.py not there yet, get:

argumenterror ------------- file doesn't exist 

during chef compilation. how can solve it?

thanks, arshavski alexander

you need use ruby_block resource, not execute resource. execute resource doesn't define command, , nothing.

ruby_block 'configure'   block     file = chef::util::fileedit.new(node["code_dir"] + "websaas/settings.py")     file.search_file_replace("'host': '*'", "'host': '" + node["db_host"] + "'")     file.write_file   end end 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -