Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add wrapper for chef-client

  • Loading branch information...
commit 54fbef91e84b5699904a9884f9547cb7f6af709f 1 parent 6f9fca9
@bryanstearns bryanstearns authored
View
1  attributes/vagrant.rb
@@ -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"
View
7 recipes/vagrant.rb
@@ -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"
View
23 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'] %> "$@"
Please sign in to comment.
Something went wrong with that request. Please try again.