Class: Actions::Staypuft::Hostgroup::OrderedDeploy

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/staypuft/hostgroup/ordered_deploy.rb

Overview

deploys Hostgroups in given order

Instance Method Summary collapse

Instance Method Details

#humanized_inputObject



32
33
34
# File 'app/lib/actions/staypuft/hostgroup/ordered_deploy.rb', line 32

def humanized_input
  planned_actions.map(&:humanized_input).join(', ')
end

#humanized_outputObject



36
37
38
39
# File 'app/lib/actions/staypuft/hostgroup/ordered_deploy.rb', line 36

def humanized_output
  action = Hostgroup::Deploy.allocate
  task_output.map { |to| action.humanized_output to }.join(", ")
end

#plan(hostgroups, hosts = hostgroups.inject([]) { |a, hg| a + hg.hosts }) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'app/lib/actions/staypuft/hostgroup/ordered_deploy.rb', line 21

def plan(hostgroups, hosts = hostgroups.inject([]) { |a, hg| a + hg.hosts })
  (Type! hostgroups, Array).all? { |v| Type! v, ::Hostgroup }
  (Type! hosts, Array).all? { |v| Type! v, ::Host::Base }

  sequence do
    hostgroups.each do |hostgroup|
      plan_action Hostgroup::Deploy, hostgroup, hosts
    end
  end
end

#task_outputObject



41
42
43
# File 'app/lib/actions/staypuft/hostgroup/ordered_deploy.rb', line 41

def task_output
  planned_actions.map(&:task_output).select { |to| !to[:hosts].empty? }
end