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.
However wen we run 'mvn package' command from terminal we can see full command output. How to tell Vagrant/Chef to show full output?
EDIT:
I've tried this but nothing has changed in output.
config.vm.provision :chef_solo do |chef|
chef.log_level = :debug
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.
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"
It prints bash/script/execute resource execution output to stdout only when:
:debug
See the code chef/Mixin/ShellOut
, line 36.
When using vagrant up
, it seems no option to provide a TTY for the ssh session, so the solution is kind of walk around after you set :debug
log level for chef:
$ vagrant up
$ vagrant ssh -- -t
- which means it passes -t
to ssh command so that there's a tty for the ssh session.chef-solo
to manually run chef, then you will get output on stdout.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With