[chef] Re: Cheh wll not work with bash


Chronological Thread 
  • From: Alexandre Russel < >
  • To:
  • Subject: [chef] Re: Cheh wll not work with bash
  • Date: Thu, 31 Oct 2013 09:22:28 +0100

this is a ruby issue, you need to escape \ 
to debug this, you could try to log the script


On Thu, Oct 31, 2013 at 9:20 AM, David Montgomery < " target="_blank"> > wrote:
Why is happening in chef?

If I run the below command line in the shell...the replace works  sed -i 's/^\(127\)/#\1/' /etc/hosts

I use chef it does not work.  Kinda shocked.  Why is chef having a problem with line of code?


bash "comment_hostname" do
  user "root"
  code <<-EOH
    sed -i 's/^\(127\)/#\1/' /etc/hosts
  EOH
  action :run
  not_if {File.exists?("#{Chef::Config[:file_cache_path]}/hostname_test")}
end






Archive powered by MHonArc 2.6.16.

§