Takuya Matsuyama
Takuya Matsuyama

Reputation: 689

How to let Chef output logs during execution of package command with action :install?

I'm using Chef for deployment. I have a simple recipe like following:

package 'my-package' do
    action :install
end

When chef-client runs this recipe on Debian, it doesn't tell any progress of apt-get in stdout. If apt-get failed to install the package, I can't get any information about the failure from the log by chef-client. I also checked /var/log/apt/term.log but there're no logs for the installation.

Here is the log output by chef-client:

[Sat, 09 Mar 2013 22:24:57 +0900] INFO: Processing package[my-package] action install (my-package::default line 19)

================================================================================
Error executing action `install` on resource 'package[my-package]'
================================================================================

Chef::Exceptions::Exec
----------------------
apt-get -y install my-package=3.0.0 returned 100, expected 0

How to let Chef output installation progress of apt-get? Should I use execute command instead of package command? Any advices would be very appreciated. Thanks.

Upvotes: 3

Views: 680

Answers (2)

dr.scre
dr.scre

Reputation: 2377

You can supply -l debug option to the chief-client.

Upvotes: 1

sethvargo
sethvargo

Reputation: 26997

This is a very Debian/Ubuntu-specific problem. Your apt-cache is out of date. You either need to run

apt-get update -y

On the target machine, or include the apt cookbook early in your run_list.

Upvotes: 0

Related Questions