Sha256: 7437c05d2765933c28d74363443ab7b3fe189eebc16061312489d46e34794580

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

require 'chef/knife/core/node_presenter'


class Chef::Knife::Core::NodePresenter

  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]}
#{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 # not Chef::Node
      super
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
knife-undev-0.1.3 lib/knife/undev/monkey_patches/node_presenter.rb
knife-undev-0.1.2 lib/knife/undev/monkey_patches/node_presenter.rb
knife-undev-0.1.1 lib/knife/undev/monkey_patches/node_presenter.rb
knife-undev-0.1.0 lib/knife/undev/monkey_patches/node_presenter.rb
knife-undev-0.0.9 lib/knife/undev/monkey_patches/node_presenter.rb