Class: Chef::Knife::ClusterPry

Inherits:
Chef::Knife show all
Includes:
Ironfan::KnifeCommon
Defined in:
lib/chef/knife/cluster_pry.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


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

def _run
  load_ironfan
  die(banner) if @name_args.empty?
  configure_dry_run

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

  ui.info("")
  ui.info([
      ui.color("You are in a cluster. There is a sign overhead reading '", :magenta),
      ui.color(@name_args.first, :yellow, :bold),
      ui.color("'.\nNext to you a burly man in a greasy apron sharpens his cleaver, \nand a lissom princess performs treacherous origami.", :magenta)
      ].join)
  ui.info(ui.color("It is Pitch Dark. You are likely to be eaten by a grue.", :black, :bold)) if target.select(&:running?).empty?

  # Commands to try:
  #   nn = Chef::Node.load('node-name')
  #   cluster_nodes = cluster.servers.map(&:chef_node)
  #   fog_computers  = cluster.servers.map(&:fog_server)
  #
  binding.pry
end