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



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

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.deployment_exists?(deployment)
    raise UffizziCore::ControllerService::DeploymentNotFoundError,
          deployment_id
  end

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