Class: UffizziCore::ConfigFile::ApplyJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/uffizzi_core/config_file/apply_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(deployment_id, config_file_id) ⇒ Object



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

def perform(deployment_id, config_file_id)
  Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment_id} Apply ConfigFile(config_file_id:#{config_file_id})")

  deployment = UffizziCore::Deployment.find(deployment_id)
  config_file = UffizziCore::ConfigFile.find(config_file_id)
  if deployment.disabled?
    Rails.logger.info("DEPLOYMENT_PROCESS deployment_id=#{deployment.id} deployment was disabled stop config file applying")
    return
  end

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

  UffizziCore::ControllerService.apply_config_file(deployment, config_file)
end