Class: Chef::Knife::ClusterList

Inherits:
Chef::Knife show all
Includes:
Ironfan::KnifeCommon
Defined in:
lib/chef/knife/cluster_list.rb

Instance Attribute Summary

Attributes included from Ironfan::KnifeCommon

#broker, #problems

Instance Method Summary collapse

Methods included from Ironfan::KnifeCommon

#all_computers, #bootstrapper, #configure_dry_run, #confirm_execution, #confirm_or_exit, #die, #discover_computers, #display, #exit_if_unhealthy!, #gemfile, #get_relevant_slice, #get_slice, #has_problem, #healthy?, included, load_deps, #load_ironfan, #pick_apart, #predicate_str, #progressbar_for_threads, #relevant?, #run, #run_bootstrap, #section, #sub_command, #wait_for_ssh

Instance Method Details

#_runObject


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/chef/knife/cluster_list.rb', line 38

def _run
  load_ironfan
  configure_dry_run
  Ironfan.dsl_files(Ironfan.clusters_dir).each{ |f| Ironfan.load_dsl_file f }

  data = Ironfan.clusters.values.map do |cluster|
    name, path = [cluster.name, cluster.source_file]
    as_table = { :cluster => name, :path => path }
    if config[:facets]
      facets = Ironfan.load_cluster(name).facets.to_a.map do |facet|
        "#{facet.name}(#{facet.instances})"
      end.join(', ')
      as_table.merge!(:facets => facets)
    end
    as_table
  end

  ui.info "Cluster Path: #{ Ironfan.clusters_dir.join ", " }"
  headers = config[:facets] ? [:cluster, :facets, :path] : [:cluster, :path] 
  Formatador.display_compact_table(data, headers)
end