Welcome to mirror list, hosted at ThFree Co, Russian Federation.

destroy_service.rb « states « terraform « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 728533a60eddedec51ece8b26dafc08fff299b9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true

module Terraform
  module States
    class DestroyService
      def initialize(state)
        @state = state
      end

      def execute
        return unless state.deleted_at?

        state.versions.each_batch(column: :version) do |batch|
          process_batch(batch)
        end

        state.destroy!
      end

      private

      attr_reader :state

      # Overridden in EE
      def process_batch(batch)
        batch.each do |version|
          version.file.remove!
        end
      end
    end
  end
end

Terraform::States::DestroyService.prepend_mod