Reputation: 329
I'm using a script to collect build spec information from the user, then using knife to clone and build a VM to spec. CHEF then copies some shell scripts to the provisioned node, then I execute those scripts using "knife ssh".
This works fine:
template '/path/to/filename.sh' do
source 'filename.sh.erb'
mode 755
end
This doesn't:
cookbook_file '/path/to/filename.sh' do
source 'filename.sh'
mode 755
end
The contents of the filename.sh.erb and filename.sh are identical. The error message I get is as follows:
DEMO-CCM2.t3fca.com bash: /tmp/C3_Component_Install.sh: /bin/bash^M: bad interpreter: No such file or directory
The very top of both files looks like this:
#!/bin/bash
If I go to the host and try to run the script manually, all of the following work just fine:
So I don't know what's wrong. Thanks in advance for any help.
Upvotes: 0
Views: 810
Reputation: 54211
You are saving the file with Windows newlines, which cookbook_file recreated for you while the template fixed during processing. If you save using Unix newlines it would be the same.
Upvotes: 0