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(&:dup).each do |resource|
        resource.backend = backend
        if resource.check
          puts "[SKIP] #{resource.id} on #{host_for(backend)}"
        else
          resource.apply
          result = resource.check ? "DONE" : "FAIL"
          puts "[#{result}] #{resource.id} on #{host_for(backend)}"
        end
      end
    end
  end.each(&:join)
end