[chef] Cheh wll not work with bash


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] Cheh wll not work with bash
  • Date: Thu, 31 Oct 2013 16:20:36 +0800

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.

§