流浪汉-如何将Chef的命令输出打印到stdout? [英] Vagrant - how to print Chef's command output to stdout?

查看:123
本文介绍了流浪汉-如何将Chef的命令输出打印到stdout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们在Chef食谱中有以下代码:

If we have in Chef cookbook code like:

if !File.exists?('/vagrant/project/target/project/WEB-INF") || node[:compile_project]
  bash "build project" do
    user "vagrant"
    cwd "/vagrant/project"
    code <<-EOH
      mvn clean
      mvn db-migration:migrate
      mvn package
    EOH
  end
end

运行无所事事时,我们只能看到构建项目为

When run vagrant up we can see only brief information that 'build project' is executed.

无论如何,我们在终端上运行'mvn package'命令,我们都能看到完整的命令输出。如何告诉Vagrant / Chef显示完整的输出?

However wen we run 'mvn package' command from terminal we can see full command output. How to tell Vagrant/Chef to show full output?

编辑:

我已经尝试过了,但是没有

I've tried this but nothing has changed in output.

config.vm.provision :chef_solo do |chef|
  chef.log_level = :debug


推荐答案

我对流浪者一无所知,但我认为这可能与te到您的问题...如果证明是无关紧要,请删除此答案!

I know nothing about vagrant but I think this may relate to your issue... Happy to delete this answer if proves to be irrelevant!


-force-formatter

表示将使用格式化程序输出而不是记录器输出

Indicates that formatter output will be used instead of logger output.

所以我发现 solo.rb 是否具有 log_location 通过添加选项-force-formatter 定义,当通过rundeck运行Chef或远程执行 ssh用户时显示输出@host chef-solo --force-formatter

So I found if solo.rb has log_location defined adding the option --force-formatter displays the output when running chef via rundeck or remotely executing ssh user@host "chef-solo --force-formatter"

这篇关于流浪汉-如何将Chef的命令输出打印到stdout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆