Class: Chef::Knife::ClusterSync

Inherits:
ClusterChef::Script show all
Defined in:
lib/chef/knife/cluster_sync.rb

Instance Method Summary collapse

Methods inherited from ClusterChef::Script

#run

Methods included from ClusterChef::KnifeCommon

#bootstrapper, #configure_dry_run, #confirm_execution, #confirm_or_exit, #die, #display, #get_relevant_slice, #get_slice, included, #load_cluster_chef, load_deps, #predicate_str, #progressbar_for_threads, #run_bootstrap, #section, #sub_command

Instance Method Details

#perform_execution(target) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/chef/knife/cluster_sync.rb', line 51

def perform_execution(target)
  if config[:chef]
    sync_to_chef target
  else Chef::Log.debug("Skipping sync to chef") ; end

  if config[:cloud] && target.any?(&:in_cloud?)
    sync_to_cloud target
  else Chef::Log.debug("Skipping sync to cloud") ; end
end

#relevant?(server) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
47
48
49
# File 'lib/chef/knife/cluster_sync.rb', line 43

def relevant?(server)
  if config[:sync_all]
    not server.bogus?
  else
    server.created? && server.in_chef?
  end
end

#sync_to_chef(target) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/chef/knife/cluster_sync.rb', line 61

def sync_to_chef(target)
  if config[:dry_run]
    ui.info "(can't do a dry-run when syncing to chef -- skipping)"
    return
  end
  ui.info "Syncing to Chef:"
  target.sync_to_chef
end

#sync_to_cloud(target) ⇒ Object



70
71
72
73
# File 'lib/chef/knife/cluster_sync.rb', line 70

def sync_to_cloud(target)
  ui.info "Syncing to cloud:"
  target.sync_to_cloud
end