Class: Serverkit::Actions::Apply

Inherits:
Base
  • Object
show all
Defined in:
lib/serverkit/actions/apply.rb

Instance Method Summary collapse

Methods inherited from Base

#call, #initialize

Constructor Details

This class inherits a constructor from Serverkit::Actions::Base

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/serverkit/actions/apply.rb', line 7

def run
  backends.map do |backend|
    Thread.new do
      recipe.resources.map(&:clone).map do |resource|
        resource.backend = backend
        resource.run_apply
        puts resource.inspect_apply_result
        resource
      end.select(&:notifiable?).flat_map(&:handlers).uniq.map(&:dup).each do |handler|
        handler.backend = backend
        handler.run_apply
        puts handler.inspect_apply_result
      end
    end
  end.each(&:join)
end