Sha256: 67fcf5b0cd239a7580640ffcfb8da14d1515ba1430e84399a773372ce25fa023

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

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]

            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]}
#{key('Run List:')}    #{node.run_list}
#{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
#{key('Attributes:')}
#{text_format(node.normal_attrs)}
MORE
            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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knife-undev-0.0.8 lib/knife/undev/monkey_patches/node_presenter.rb