Skip to content

Commit

Permalink
Merge pull request #482 from UffizziCloud/feature/1205_disable_cluste…
Browse files Browse the repository at this point in the history
…rs_when_project_deleted

[1205] disable clusters after project deletion
  • Loading branch information
moklidia authored Oct 6, 2023
2 parents 037821b + e315842 commit f8f5eba
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/app/lib/uffizzi_core/concerns/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module UffizziCore::Concerns::Models::Project
extend ActiveSupport::Concern

# rubocop:disable Metrics/BlockLength
included do
include AASM
include UffizziCore::StateMachineConcern
Expand Down Expand Up @@ -43,10 +44,15 @@ module UffizziCore::Concerns::Models::Project

def after_disable
disable_deployments
disable_clusters
end

def active_deployments
deployments.active
deployments.enabled
end

def active_clusters
clusters.enabled
end

def disable_deployments
Expand All @@ -56,8 +62,13 @@ def disable_deployments
end
end

def disable_clusters
active_clusters.each(&:disable!)
end

def compose_file
compose_files.main.first
end
end
# rubocop:enable Metrics/BlockLength
end

0 comments on commit f8f5eba

Please sign in to comment.