Output formatter doc lacks information about handlers

Hi,

I’m not sure, if I’m missing something, but to me it looks like the doc
formatter (that’s the default one when I’m running chef-client, isn’t
it?) is missing all the information about running start/report and
probably even exception handlers.

When I use the “minimal” formatter (chef-client -l min) or trigger the
chef run through SSH (ssh node sudo chef-client), then this information
appears (how is that formatter called? I can’t find any formatters other
than min(imal) and doc in 11.8).

So… am I overlooking something or is this a bug?

It feels a bit, like the handler_executed event is not processed.

Thanks for your feedback
Steffen

On Saturday, November 16, 2013 at 1:21 PM, Steffen Gebert wrote:

Hi,

I'm not sure, if I'm missing something, but to me it looks like the doc
formatter (that's the default one when I'm running chef-client, isn't
it?) is missing all the information about running start/report and
probably even exception handlers.

When I use the "minimal" formatter (chef-client -l min) or trigger the
chef run through SSH (ssh node sudo chef-client), then this information
appears (how is that formatter called? I can't find any formatters other
than min(imal) and doc in 11.8).

So.. am I overlooking something or is this a bug?

It feels a bit, like the handler_executed event is not processed.

Thanks for your feedback
Steffen

A patch for this would be welcome.

--
Daniel DeLeo

Hi Daniel,

A patch for this would be welcome.

Any hint, where to start?

Thanks
Steffen

On 18/11/13 18:02, Daniel DeLeo wrote:

On Saturday, November 16, 2013 at 1:21 PM, Steffen Gebert wrote:

Hi,

I'm not sure, if I'm missing something, but to me it looks like the doc
formatter (that's the default one when I'm running chef-client, isn't
it?) is missing all the information about running start/report and
probably even exception handlers.

When I use the "minimal" formatter (chef-client -l min) or trigger the
chef run through SSH (ssh node sudo chef-client), then this information
appears (how is that formatter called? I can't find any formatters other
than min(imal) and doc in 11.8).

So.. am I overlooking something or is this a bug?

It feels a bit, like the handler_executed event is not processed.

Thanks for your feedback
Steffen

A patch for this would be welcome.

On Monday, November 18, 2013 at 4:27 PM, Steffen Gebert wrote:

Hi Daniel,

A patch for this would be welcome.

Any hint, where to start?

Thanks
Steffen

This is the default formatter: chef/lib/chef/formatters/doc.rb at main · chef/chef · GitHub

It inherits from EventDispatch::Base (via one or two other classes) chef/lib/chef/event_dispatch/base.rb at main · chef/chef · GitHub so all you need to do is define the correct method and make it print something. Try to match the markdown-ish style of the rest of the implementation.

HTH,

--
Daniel DeLeo

Hi Daniel,

A patch for this would be welcome.

I just noticed that the difference is the log level :-/

When I run chef-client -l info, I get some output, of course.

Should I still add that to the doc formatter?

The output would be then

Running handlers:
[2013-11-25T19:26:42+01:00] INFO: Running report handlers

  • LastRunUpdateHandler finished
  • Etckeeper::CommitHandler finished
    [2013-11-25T19:26:43+01:00] INFO: Zabbix::Report handler started
  • Zabbix::Report finished

Running handlers completed

[2013-11-25T19:26:43+01:00] INFO: Report handlers complete

(where the "Zabbix::Report handler started" part comes from the handler
itself).

With -l warn it looks like this:

Running handlers:

  • LastRunUpdateHandler finished
  • Etckeeper::CommitHandler finished
  • Zabbix::Report finished

Running handlers completed

Code is here:

Yours
Steffen

On 19/11/13 01:32, Daniel DeLeo wrote:

On Monday, November 18, 2013 at 4:27 PM, Steffen Gebert wrote:

Hi Daniel,

A patch for this would be welcome.

Any hint, where to start?

Thanks
Steffen

This is the default formatter: chef/lib/chef/formatters/doc.rb at main · chef/chef · GitHub

It inherits from EventDispatch::Base (via one or two other classes) chef/lib/chef/event_dispatch/base.rb at main · chef/chef · GitHub so all you need to do is define the correct method and make it print something. Try to match the markdown-ish style of the rest of the implementation.

On Monday, November 25, 2013 at 10:31 AM, Steffen Gebert wrote:

Hi Daniel,

A patch for this would be welcome.

I just noticed that the difference is the log level :-/

When I run chef-client -l info, I get some output, of course.

Should I still add that to the doc formatter?

The output would be then

Running handlers:
[2013-11-25T19:26:42+01:00] INFO: Running report handlers

  • LastRunUpdateHandler finished
  • Etckeeper::CommitHandler finished
    [2013-11-25T19:26:43+01:00] INFO: Zabbix::Report handler started
  • Zabbix::Report finished

Running handlers completed

[2013-11-25T19:26:43+01:00] INFO: Report handlers complete

(where the "Zabbix::Report handler started" part comes from the handler
itself).

With -l warn it looks like this:

Running handlers:

  • LastRunUpdateHandler finished
  • Etckeeper::CommitHandler finished
  • Zabbix::Report finished

Running handlers completed

Code is here:

Commits · StephenKing/chef · GitHub

Yours
Steffen

Yes, the general idea is that whenever a human is running chef-client, the formatter output should be used, while the logger output is still used when logging to a file or central aggregator for post-hoc analysis. The “doc” formatter is intended to be the sorta-verbose default that uses color and structure to make information more scannable, so if there’s a crucial piece of information missing, then it should be included.

--
Daniel DeLeo

Thanks for your quick reply, Daniel!

Do you agree with the format I've posted?

I'm unfortunately not able to get rid of the empty line before the
"completed" line.

As these handlers are "actively" executed: should they be colored in green?

Yours
Steffen

On 25/11/13 19:41, Daniel DeLeo wrote:

On Monday, November 25, 2013 at 10:31 AM, Steffen Gebert wrote:

Hi Daniel,

A patch for this would be welcome.

I just noticed that the difference is the log level :-/

When I run chef-client -l info, I get some output, of course.

Should I still add that to the doc formatter?

The output would be then

Running handlers:
[2013-11-25T19:26:42+01:00] INFO: Running report handlers

  • LastRunUpdateHandler finished
  • Etckeeper::CommitHandler finished
    [2013-11-25T19:26:43+01:00] INFO: Zabbix::Report handler started
  • Zabbix::Report finished

Running handlers completed

[2013-11-25T19:26:43+01:00] INFO: Report handlers complete

(where the "Zabbix::Report handler started" part comes from the handler
itself).

With -l warn it looks like this:

Running handlers:

  • LastRunUpdateHandler finished
  • Etckeeper::CommitHandler finished
  • Zabbix::Report finished

Running handlers completed

Code is here:

Commits · StephenKing/chef · GitHub

Yours
Steffen

Yes, the general idea is that whenever a human is running chef-client, the formatter output should be used, while the logger output is still used when logging to a file or central aggregator for post-hoc analysis. The “doc” formatter is intended to be the sorta-verbose default that uses color and structure to make information more scannable, so if there’s a crucial piece of information missing, then it should be included.

--
Daniel DeLeo

On Monday, November 25, 2013 at 12:57 PM, Steffen Gebert wrote:

Thanks for your quick reply, Daniel!

Do you agree with the format I've posted?

I'm unfortunately not able to get rid of the empty line before the
"completed" line.

As these handlers are "actively" executed: should they be colored in green?

Yours
Steffen

Try them both? If you’re looking for opinions, maybe you can attach screenshots to the Pull Request.

I think green would be consistent with how resources look in the formatter now.

--
Daniel DeLeo