在控制台中显示 chef Execute 运行时的输出

在控制台中显示 chef Execute 运行时的输出

我在厨师食谱中有以下片段:

chef::Log.info("Installing pips using requirements file: #{requirements_file}")
execute "pip install -E #{ve.path} -r #{requirements_file}" do
  user deploy_user
  cwd deploy_path
end

这将安装许多软件包,当我通过 SSH 调用 chef-client 时,我希望看到“pip install”的输出,因为 chef-client 正在运行。有没有办法记录执行命令的输出,以便在 pip 运行时写入日志?

答案1

如果您正在查看 chef,请使用“-l debug”运行它以显示它。或者,pip 可以使用“--log=FILENAME”选项记录活动。

相关内容