2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module Clusters
|
|
|
|
module Concerns
|
|
|
|
module ApplicationCore
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
belongs_to :cluster, class_name: 'Clusters::Cluster', foreign_key: :cluster_id
|
|
|
|
|
|
|
|
validates :cluster, presence: true
|
|
|
|
|
|
|
|
after_initialize :set_initial_status
|
|
|
|
|
|
|
|
def set_initial_status
|
|
|
|
return unless not_installable?
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
self.status = 'installable' if cluster&.application_helm_available?
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def self.application_name
|
|
|
|
self.to_s.demodulize.underscore
|
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
|
|
|
self.class.application_name
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
def schedule_status_update
|
|
|
|
# Override if you need extra data synchronized
|
|
|
|
# from K8s after installation
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|