Class: UffizziCore::Deployment::CreateCredentialJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/uffizzi_core/deployment/create_credential_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(deployment_id, credential_id) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/jobs/uffizzi_core/deployment/create_credential_job.rb', line 14

def perform(deployment_id, credential_id)
  Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment_id} CreateCredentialJob(cred_id:#{credential_id})")

  deployment = UffizziCore::Deployment.find(deployment_id)
  credential = UffizziCore::Credential.find(credential_id)

  if deployment.disabled?
    Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment.id} deployment was disabled stop creating credential")
    return
  end

  unless UffizziCore::ControllerService.deployment_exists?(deployment)
    raise UffizziCore::DeploymentNotFoundError,
          deployment_id
  end

  UffizziCore::ControllerService.apply_credential(deployment, credential)
end