Class: UffizziCore::Deployment::UpdateCredentialJob

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

Instance Method Summary collapse

Instance Method Details

#perform(deployment_id, credential_id) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/jobs/uffizzi_core/deployment/update_credential_job.rb', line 21

def perform(deployment_id, credential_id)
  Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment_id} UpdateCredentialJob(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 updating credential")
    return
  end

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

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