Class: Chef::Knife::EnvironmentFromRealm

Inherits:
Chef::Knife show all
Includes:
Ironfan::KnifeCommon
Defined in:
lib/chef/knife/environment_from_realm.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
# File 'lib/chef/knife/environment_from_realm.rb', line 38

def _run
  load_ironfan
  die(banner) unless @name_args.size == 1
  configure_dry_run

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

  env = Chef::Environment.new.tap do |env|
    env.name target.environment.to_s
    env.description "Ironfan-created environment for #{target.name} realm"
    Chef::Log.info "pinning cookbooks in #{target.name} realm"
    target.cookbook_reqs.each do |cookbook, version|
      Chef::Log.info "  pinning cookbook #{cookbook} #{version}"
      env.cookbook cookbook, version
    end
  end

  env.save unless config[:dry_run]
end