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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/terraform/state.rb')
-rw-r--r--app/models/terraform/state.rb12
1 files changed, 1 insertions, 11 deletions
diff --git a/app/models/terraform/state.rb b/app/models/terraform/state.rb
index 8c3b85ac4c3..4d17a4d332c 100644
--- a/app/models/terraform/state.rb
+++ b/app/models/terraform/state.rb
@@ -23,13 +23,10 @@ module Terraform
scope :ordered_by_name, -> { order(:name) }
scope :with_name, -> (name) { where(name: name) }
- validates :name, presence: true, uniqueness: { scope: :project_id }
- validates :project_id, presence: true
+ validates :project_id, :name, presence: true
validates :uuid, presence: true, uniqueness: true, length: { is: UUID_LENGTH },
format: { with: HEX_REGEXP, message: 'only allows hex characters' }
- before_destroy :ensure_state_is_unlocked
-
default_value_for(:uuid, allows_nil: false) { SecureRandom.hex(UUID_LENGTH / 2) }
def latest_file
@@ -90,13 +87,6 @@ module Terraform
new_version.save!
end
- def ensure_state_is_unlocked
- return unless locked?
-
- errors.add(:base, s_("Terraform|You cannot remove the State file because it's locked. Unlock the State file first before removing it."))
- throw :abort # rubocop:disable Cop/BanCatchThrow
- end
-
def parse_serial(file)
Gitlab::Json.parse(file)["serial"]
rescue JSON::ParserError