diff options
Diffstat (limited to 'app/jobs')
-rw-r--r-- | app/jobs/setup_job.rb | 5 | ||||
-rw-r--r-- | app/jobs/terraform_job.rb | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/app/jobs/setup_job.rb b/app/jobs/setup_job.rb new file mode 100644 index 0000000..c7b1b80 --- /dev/null +++ b/app/jobs/setup_job.rb @@ -0,0 +1,5 @@ +class SetupJob < TerraformJob + def run_terraform + puts "Setting up #{@mini_environment.name}" + end +end diff --git a/app/jobs/terraform_job.rb b/app/jobs/terraform_job.rb new file mode 100644 index 0000000..739a5b5 --- /dev/null +++ b/app/jobs/terraform_job.rb @@ -0,0 +1,17 @@ +class TerraformJob < Que::Job + def run(mini_environment_id) + ActiveRecord::Base.transaction do + @mini_environment = MiniEnvironment.find(mini_environment_id) + + run_terraform + end + end + + def destroy + FinishedTerraformJob.create( + mini_environment_id: @mini_environment.id, + job_class: attrs[:job_class] + ) + super + end +end |