diff options
author | joe.nuspl <joe.nuspl@workday.com> | 2021-05-08 15:00:24 -0700 |
---|---|---|
committer | joe.nuspl <joe.nuspl@workday.com> | 2021-05-08 15:00:24 -0700 |
commit | d7694e6f11fb46f05047fd0f6f1e51ca963e6c0c (patch) | |
tree | f7f2ac240903281e9190137a5ad1d98630aaae0a | |
parent | 9af5e4c7c91fb48818101cc012a17151ec019f21 (diff) | |
download | chef-d7694e6f11fb46f05047fd0f6f1e51ca963e6c0c.tar.gz |
Silence `bundle install` warning when installing gems for cookbooks
```
[2021-05-08T15:03:38+00:00] INFO: Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
```
Signed-off-by: Joseph J. Nuspl Jr. <nuspl@nvwls.com>
-rw-r--r-- | lib/chef/cookbook/gem_installer.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/cookbook/gem_installer.rb b/lib/chef/cookbook/gem_installer.rb index d7c18627de..e892212e32 100644 --- a/lib/chef/cookbook/gem_installer.rb +++ b/lib/chef/cookbook/gem_installer.rb @@ -70,7 +70,11 @@ class Chef unless Chef::Config[:skip_gem_metadata_installation] # Add additional options to bundle install cmd = [ "bundle", "install", Chef::Config[:gem_installer_bundler_options] ] - so = shell_out!(cmd, cwd: dir, env: { "PATH" => path_with_prepended_ruby_bin }) + env = { + "PATH" => path_with_prepended_ruby_bin, + "BUNDLE_SILENCE_ROOT_WARNING" => "1", + } + so = shell_out!(cmd, cwd: dir, env: env) Chef::Log.info(so.stdout) end end |