summaryrefslogtreecommitdiff
path: root/app/models/environment.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2016-11-22 19:55:56 +0000
committerNick Thomas <nick@gitlab.com>2016-12-19 19:53:04 +0000
commitc3d972f4e861059312c2708dacb57999416fcc70 (patch)
tree977d60c01a81da4157aa1961b244e9967c9168ee /app/models/environment.rb
parent5378302763e1a461bab5213aa379d5b9e6dc322c (diff)
downloadgitlab-ce-c3d972f4e861059312c2708dacb57999416fcc70.tar.gz
Add terminals to the Kubernetes deployment service
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 8ef1c841ea3..5cde94b3509 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -128,6 +128,14 @@ class Environment < ActiveRecord::Base
end
end
+ def has_terminals?
+ project.deployment_service.present? && available? && last_deployment.present?
+ end
+
+ def terminals
+ project.deployment_service.terminals(self) if has_terminals?
+ end
+
# An environment name is not necessarily suitable for use in URLs, DNS
# or other third-party contexts, so provide a slugified version. A slug has
# the following properties: