diff options
author | Christopher Baines <mail@cbaines.net> | 2018-01-27 23:23:05 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-03-29 07:28:05 +0100 |
commit | eb3177b0d8de10f316ac595dff3b8165cf828796 (patch) | |
tree | 501b338a14a3cedc71c9a33a17d5810848374572 /app/jobs | |
download | govuk-mini-environment-admin-eb3177b0d8de10f316ac595dff3b8165cf828796.tar govuk-mini-environment-admin-eb3177b0d8de10f316ac595dff3b8165cf828796.tar.gz |
Initial commit
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 |