aboutsummaryrefslogtreecommitdiff
path: root/app/jobs
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-04-03 08:24:55 +0100
committerChristopher Baines <mail@cbaines.net>2018-04-12 08:30:05 +0100
commit9ea06728905df840e8f244f0943f599f725604a7 (patch)
tree2b699654aa9ac551fd92866d5a38b05dce0d5a84 /app/jobs
parentb84de36ae80f2b86f6f8d78163a84a7c5eb10b1e (diff)
downloadgovuk-mini-environment-admin-9ea06728905df840e8f244f0943f599f725604a7.tar
govuk-mini-environment-admin-9ea06728905df840e8f244f0943f599f725604a7.tar.gz
Improve the DestroyJob
Use the MiniEnvironmentJob class, and just call the destroy method on the relevant backend.
Diffstat (limited to 'app/jobs')
-rw-r--r--app/jobs/destroy_job.rb22
1 files changed, 2 insertions, 20 deletions
diff --git a/app/jobs/destroy_job.rb b/app/jobs/destroy_job.rb
index a57d530..ff1f713 100644
--- a/app/jobs/destroy_job.rb
+++ b/app/jobs/destroy_job.rb
@@ -21,25 +21,7 @@
class DestroyJob < MiniEnvironmentJob
@retry_interval = 30
- def run_terraform
- puts "Destroying #{@mini_environment.name}"
-
- Dir.chdir('terraform/aws') do
- RubyTerraform.destroy(
- vars: {
- aws_region: 'eu-west-1',
- slug: @mini_environment.name.parameterize,
- ssh_public_key: ssh_public_key,
- start_command: @mini_environment.start_command
- },
- force: true
- )
- end
- end
-
- def ssh_public_key
- File.open("#{ENV['HOME']}/.ssh/id_rsa.pub") do |file|
- file.readline()
- end
+ def perform_mini_environment_action
+ @mini_environment.backend.destroy(@mini_environment)
end
end