Unable to execute code in single environment of bash

I was unable to execute a code in single environment which is resulting in failure of chef-client run. I have the following code

code <<-EOH
command a
command b
command c

if we run the three commands one after the other we won’t get error if we switch the environment it will show us error.

It sounds like you need to pass some environment settings to the bash resource:


Specifically, this kind of example:

bash ‘install_ruby_build’ do
cwd '#{Chef::Config[:file_cache_path]}/ruby-build’
user 'rbenv’
group 'rbenv’
code <<-EOH
environment ‘PREFIX’ => '/usr/local’

What we typically do for apps that require this is generate a simple helper method that sets the appropriate settings and then just say “environment my_helper_name” instead (like “environment concierge_env”).

Nathan Clemons
DevOps Engineer
Moxie Cloud Services (MCS)

O +1.425.467.5075
M +1.360.861.6291
E nclemons@gomoxie.com
W www.gomoxie.comhttp://www.gomoxie.com/