Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off verbose_logging for single Chef recipes or resources

I have a recipe which copies a secret_key to my node. Actually the file content is logged into my shell. I want to turn that off for this single recipe, because I don't want the file content to be saved into my shell history. I know that it's possible to completely deactivate the logging with the verbose_logging setting in client.rb.

verbose_logging: Set the log level. Options: true, nil, and false. When this is set to false, notifications about individual resources being processed are suppressed (and are output at the :info logging level). Setting this to false can be useful when a chef-client is run as a daemon. Default value: nil.

But is it possible to deactivate the logging only for a single recipe?

like image 246
coderuby Avatar asked Nov 13 '15 17:11

coderuby


People also ask

How do I disable Chef client?

Stops and disables chef-client systemd unit: sudo systemctl stop chef-client and sudo systemctl disable chef-client. Overrides /usr/bin/chef-client with a shell script emitting the log message, its timestamp, and the user who logged it.

How do you debug a Chef recipe?

Use the breakpoint resource to add breakpoints to recipes. Run the chef-shell in chef-client mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the chef-client during an actual chef-client run.


1 Answers

There is a common property called sensitive, which will

Ensure that sensitive resource data is not logged by the chef-client. Default value: false. This property only applies to the execute, file and template resources.

template "/etc/my.secret" do
  sensitive true
end
like image 125
StephenKing Avatar answered Sep 25 '22 10:09

StephenKing