Class: Clusters::Gcp::VerifyProvisionStatusService

Inherits:
Object
  • Object
show all
Defined in:
app/services/clusters/gcp/verify_provision_status_service.rb

Constant Summary collapse

INITIAL_INTERVAL =
2.minutes
EAGER_INTERVAL =
10.seconds
TIMEOUT =
20.minutes

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#providerObject (readonly)

Returns the value of attribute provider


6
7
8
# File 'app/services/clusters/gcp/verify_provision_status_service.rb', line 6

def provider
  @provider
end

Instance Method Details

#execute(provider) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/clusters/gcp/verify_provision_status_service.rb', line 12

def execute(provider)
  @provider = provider

  request_operation do |operation|
    case operation.status
    when 'PENDING', 'RUNNING'
      continue_creation(operation)
    when 'DONE'
      finalize_creation
    else
      provider.make_errored!("Unexpected operation status; #{operation.status} #{operation.status_message}")
    end
  end
end