aboutsummaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2018-07-05 11:48:42 +0100
committerChristopher Baines <mail@cbaines.net>2018-07-05 11:48:42 +0100
commit358cdccfa8fba8d446543b7347f89098d904e136 (patch)
tree825069c6d76df84f7ec1bc648ee2ea8e4594fd22 /app/models
parent0b2df284100db9c03dcdc290f99091f199fb5eef (diff)
downloadgovuk-mini-environment-admin-358cdccfa8fba8d446543b7347f89098d904e136.tar
govuk-mini-environment-admin-358cdccfa8fba8d446543b7347f89098d904e136.tar.gz
Only show available backends on the setup page
Diffstat (limited to 'app/models')
-rw-r--r--app/models/backends/terraform_aws.rb4
-rw-r--r--app/models/backends/terraform_libvirt.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/app/models/backends/terraform_aws.rb b/app/models/backends/terraform_aws.rb
index 65ca68c..d3d56d1 100644
--- a/app/models/backends/terraform_aws.rb
+++ b/app/models/backends/terraform_aws.rb
@@ -50,6 +50,10 @@ class Backends::TerraformAws < ApplicationRecord
'Amazon Web Services'
end
+ def self.available?
+ File.exist? "#{ENV['PATH'].split(':').first}/terraform-provider-aws"
+ end
+
def type_and_id
"#{self.class.name}=#{id}"
end
diff --git a/app/models/backends/terraform_libvirt.rb b/app/models/backends/terraform_libvirt.rb
index b8bdf13..bbc872a 100644
--- a/app/models/backends/terraform_libvirt.rb
+++ b/app/models/backends/terraform_libvirt.rb
@@ -44,6 +44,10 @@ class Backends::TerraformLibvirt < ApplicationRecord
'libvirt'
end
+ def self.available?
+ File.exist? "#{ENV['PATH'].split(':').first}/terraform-provider-libvirts"
+ end
+
def type_and_id
"#{self.class.name}=#{id}"
end