add option to not provision databases for servers

This commit is contained in:
Adam Cooke
2017-05-08 16:41:37 +01:00
parent 87560c9edf
commit 5cd0e4dc04
+8 -2
View File
@@ -46,6 +46,8 @@ class Server < ApplicationRecord
include HasUUID
include HasSoftDestroy
attr_accessor :provision_database
belongs_to :organization
belongs_to :ip_pool, :optional => true
has_many :domains, :dependent => :destroy, :as => :owner
@@ -82,11 +84,15 @@ class Server < ApplicationRecord
end
after_create do
message_db.provisioner.provision
unless self.provision_database == false
message_db.provisioner.provision
end
end
after_commit(:on => :destroy) do
message_db.provisioner.drop
unless self.provision_database == false
message_db.provisioner.drop
end
end
def status