From 7d0ae40d42613aac09f16627edd93a4f46ce1582 Mon Sep 17 00:00:00 2001 From: Evan Stachowiak Date: Wed, 12 Sep 2012 18:19:11 -0400 Subject: fixed bug when running bundler from user other than root --- manifests/config.pp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index e7f70e6..f61a83e 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -51,23 +51,24 @@ define bundler::config ( $home_dir = '/root' } else { - $home_dir = "${home_dir_base_path}/$user" + $home_dir = "${home_dir_base_path}/${user}" } # Must use $bundler_path_real, otherwise cannot reassign variable error is thrown if $use_rvm == 'true' { $bundler_path_rvm = "${rvm_gem_path}/${ruby_version}@${rvm_gemset}/bin" - $bundler_config_command = "${rvm_bin} ${ruby_version} exec ${bundler_path_rvm}/bundle config build.${name} ${config_flag}" + $bundler_bin = "${rvm_bin} ${ruby_version} exec ${bundler_path_rvm}/bundle" } else { - $bundler_config_command = "${bundler_path}/bundle config build.${name} ${config_flag}" + $bundler_bin = "${bundler_path}/bundle" } + # Bundler doesn't respect uid. Use /bin/su to override this behavior for users + # other than root. exec { "bundler_config_${name}": - cwd => $app_dir, - command => $bundler_config_command, - unless => "/bin/grep -i \"BUNDLE_BUILD__${name}: ${config_flag}\" ${home_dir}/.bundle/config", - user => $user, + cwd => $app_dir, + command => "/bin/su -c '${bundler_bin} config build.${name} ${config_flag} --gemfile=${app_dir}/Gemfile' ${user}", + unless => "/bin/grep -i \"BUNDLE_BUILD__${name}: ${config_flag}\" ${home_dir}/.bundle/config", } } -- cgit v1.2.3