【发布时间】:2021-02-10 20:29:37
【问题描述】:
我们使用 Chef 来设置和执行 Bundler。我们之前在bash 资源中运行bundle install,并将user 和group 属性设置为target_user(捆绑器操作旨在以该用户身份运行)。
由于某些选项(即--deployment、--path 和--without)已弃用,我们现在需要通过bundle config 配置它们。
但是,当使用相同的资源配置时,Bundle 似乎无法按预期工作;我们得到Bundler::SudoNotPermittedError: Bundler requires sudo access to install...,我想这是因为配置文件没有存储在正确的位置,和/或读取。
execute 资源应该如何配置?目前是:
# Simplified version
bash "Install gems" do
code <<~EOF
bundle config --local deployment true &&
bundle config --local path /path/to/gems_dir &&
bundle install --gemfile=/path/to/Gemfile
EOF
user "target_user"
group "target_user"
end
【问题讨论】:
标签: ruby bash environment-variables chef-infra environment