diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-09-27 06:52:30 +0300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-09-27 09:14:18 +0300 |
commit | 4392ad80d4c72dcd52cf381a32c428656d2aaa77 (patch) | |
tree | 3048b28981b2b9c5776eedb015978d364ad0693c | |
parent | 45a5a371a214b7a3e478ddd08f18c29753add000 (diff) |
Port EE::Clusters::ApplicationStatus to CE
Cluster applications in CE will need access to the same status values
for updating
-rw-r--r-- | app/models/clusters/concerns/application_status.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb index d4d3859dfd5..a9df59fc059 100644 --- a/app/models/clusters/concerns/application_status.rb +++ b/app/models/clusters/concerns/application_status.rb @@ -15,6 +15,9 @@ module Clusters state :scheduled, value: 1 state :installing, value: 2 state :installed, value: 3 + state :updating, value: 4 + state :updated, value: 5 + state :update_errored, value: 6 event :make_scheduled do transition [:installable, :errored] => :scheduled @@ -32,6 +35,18 @@ module Clusters transition any => :errored end + event :make_updating do + transition [:installed, :updated, :update_errored] => :updating + end + + event :make_updated do + transition [:updating] => :updated + end + + event :make_update_errored do + transition any => :update_errored + end + before_transition any => [:scheduled] do |app_status, _| app_status.status_reason = nil end @@ -40,6 +55,15 @@ module Clusters status_reason = transition.args.first app_status.status_reason = status_reason if status_reason end + + before_transition any => [:updating] do |app_status, _| + app_status.status_reason = nil + end + + before_transition any => [:update_errored] do |app_status, transition| + status_reason = transition.args.first + app_status.status_reason = status_reason if status_reason + end end end end |