2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-03 17:24:32 -04:00
|
|
|
class ClusterProvisionWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2017-10-03 13:33:37 -04:00
|
|
|
include ClusterQueue
|
2017-09-30 11:54:22 -04:00
|
|
|
|
|
|
|
def perform(cluster_id)
|
2017-10-13 13:21:23 -04:00
|
|
|
Clusters::Cluster.find_by_id(cluster_id).try do |cluster|
|
2017-10-30 11:18:15 -04:00
|
|
|
cluster.provider.try do |provider|
|
|
|
|
Clusters::Gcp::ProvisionService.new.execute(provider) if cluster.gcp?
|
2017-10-13 13:21:23 -04:00
|
|
|
end
|
2018-11-02 11:46:15 -04:00
|
|
|
|
|
|
|
ClusterPlatformConfigureWorker.perform_async(cluster.id) if cluster.user?
|
2017-09-30 11:54:22 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|