Parent

Included Modules

Class/Module Index [+]

Quicksearch

Chef::Knife::ClusterShow

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/cluster_show.rb, line 37
def run
  with_verbosity(1){ config[:include_terminated] = true }
  load_ironfan
  die(banner) if @name_args.empty?
  configure_dry_run

  # Load the cluster/facet/slice/whatever
  target = get_slice(* @name_args)

  dump_command_config
  dump_chef_config
  #
  target.each do |computer|
    dump_computer(computer)
  end

  # Display same
  display(target)
end

Protected Instance Methods

dump(title, hsh) click to toggle source
# File lib/chef/knife/cluster_show.rb, line 83
def dump(title, hsh)
  Chef::Log.info( ["", "*"*50, "", "#{title}: ", ""].join("\n") )
  Chef::Log.info( MultiJson.dump(hsh, pretty: true ) )
end
dump_chef_config() click to toggle source
# File lib/chef/knife/cluster_show.rb, line 76
def dump_chef_config
  with_verbosity 2 do
    chef_config_hash = Hash[Chef::Config.keys.map{|key| [key, Chef::Config[key]]}]
    dump("Chef Config", chef_config_hash)
  end
end
dump_command_config() click to toggle source
# File lib/chef/knife/cluster_show.rb, line 69
def dump_command_config
  with_verbosity 2 do
    Chef::Log.info( ["", "*"*50, "", "Command Config", ""].join("\n") )
    dump("Command config", self.config)
  end
end
dump_computer(computer) click to toggle source
# File lib/chef/knife/cluster_show.rb, line 59
def dump_computer(computer)
  header = "Computer #{computer.name} (#{computer.class})"
  with_verbosity 1 do
    Chef::Log.info(header)
  end
  with_verbosity 2 do
    dump(header, computer.to_wire)
  end
end
with_verbosity(num) click to toggle source
# File lib/chef/knife/cluster_show.rb, line 88
def with_verbosity(num)
  yield if config[:verbosity] >= num
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.