lib/knife/undev/monkey_patches/node_presenter.rb in knife-undev-0.0.8 vs lib/knife/undev/monkey_patches/node_presenter.rb in knife-undev-0.0.9

- old
+ new

@@ -1,19 +1,16 @@ -require 'chef/knife' require 'chef/knife/core/node_presenter' -class Chef - class Knife - module Core - def summarize(data) - if data.kind_of?(Chef::Node) - node = data - # special case ec2 with their split horizon whatsis. - ip = (node[:private_ipaddress]) || node[:ipaddress] +class Chef::Knife::Core::NodePresenter - summarized=<<-SUMMARY + def summarize(data) + if data.kind_of?(Chef::Node) + node = data + ip = node[:ipaddress] + + summarized=<<-SUMMARY #{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)} #{key('Environment:')} #{node.chef_environment} #{key('FQDN:')} #{node[:fqdn]} #{key('IP:')} #{ip} #{key('Private IP:')} #{node[:private_ipaddress]} @@ -21,30 +18,30 @@ #{key('Roles:')} #{Array(node[:roles]).join(', ')} #{key('Recipes:')} #{Array(node[:recipes]).join(', ')} #{key('Platform:')} #{node[:platform]} #{node[:platform_version]} #{key('Tags:')} #{Array(node[:tags]).join(', ')} SUMMARY - if config[:medium_output] || config[:long_output] - summarized +=<<-MORE + if config[:medium_output] || config[:long_output] + summarized +=<<-MORE #{key('Attributes:')} #{text_format(node.normal_attrs)} MORE - end - if config[:long_output] - summarized +=<<-MOST + end + + if config[:long_output] + summarized +=<<-MOST #{key('Default Attributes:')} #{text_format(node.default_attrs)} #{key('Override Attributes:')} #{text_format(node.override_attrs)} #{key('Automatic Attributes (Ohai Data):')} #{text_format(node.automatic_attrs)} MOST - end - summarized - else - super - end - end - + end + + summarized + else # not Chef::Node + super end end + end