Skip to content

Commit

Permalink
Add wrapper for chef-client
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanstearns committed Mar 7, 2012
1 parent 6f9fca9 commit 54fbef9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions attributes/vagrant.rb
Expand Up @@ -19,4 +19,5 @@
# limitations under the License.
#

default['rvm']['vagrant']['system_chef_client'] = "/opt/ruby/bin/chef-client"
default['rvm']['vagrant']['system_chef_solo'] = "/opt/ruby/bin/chef-solo"
7 changes: 7 additions & 0 deletions recipes/vagrant.rb
Expand Up @@ -17,6 +17,13 @@
# limitations under the License.
#

template "/usr/local/bin/chef-client" do
source "vagrant-chef-client-wrapper.erb"
owner "root"
group "root"
mode "0755"
end

template "/usr/local/bin/chef-solo" do
source "vagrant-chef-solo-wrapper.erb"
owner "root"
Expand Down
23 changes: 23 additions & 0 deletions templates/default/vagrant-chef-client-wrapper.erb
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# RVM-aware chef-client wrapper
#
# Generated by Chef for <%= node[:fqdn] %>
# Local modifications will be overridden

if [[ -d "<%= node['rvm']['root_path'] %>" ]] ; then
export PATH="/bin:<%= node['rvm']['root_path'] %>:$PATH"
rvm_path='<%= node['rvm']['root_path'] %>'
export rvm_path
unset RUBY_VERSION
unset GEM_HOME
unset GEM_PATH
unset MY_RUBY_HOME
unset IRBRC
rvm_ruby_string='system'
export rvm_ruby_string
unset rvm_gemset_name
unset MAGLEV_HOME
fi

exec <%= node['rvm']['vagrant']['system_chef_client'] %> "$@"

0 comments on commit 54fbef9

Please sign in to comment.