Skip to content
Snippets Groups Projects
Commit 67e12219 authored by Kamil Trzcińśki's avatar Kamil Trzcińśki
Browse files

Rework initial state

parent 1bd1d462
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -11,14 +11,16 @@ module Clusters
 
validates :cluster, presence: true
 
after_initialize :set_initial_status
def self.application_name
self.to_s.demodulize.underscore
end
 
def set_initial_status
self.status = 0 unless cluster&.platform_kubernetes_active?
def initial_status
if cluster&.platform_kubernetes_active?
:installable
else
:not_installable
end
end
 
def name
Loading
Loading
Loading
Loading
@@ -4,7 +4,7 @@ module Clusters
extend ActiveSupport::Concern
 
included do
state_machine :status, initial: :installable do
state_machine :status, initial: ->(application) { application.initial_status } do
state :not_installable, value: -2
state :errored, value: -1
state :installable, value: 0
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment