Class: Terraform::State
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Terraform::State
- Includes:
- AfterCommitQueue, UsageStatistics
- Defined in:
- app/models/terraform/state.rb
Constant Summary collapse
- HEX_REGEXP =
%r{\A\h+\z}
- UUID_LENGTH =
32
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Method Summary collapse
Methods included from AfterCommitQueue
#run_after_commit, #run_after_commit_or_now
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Instance Method Details
#latest_file ⇒ Object
35 36 37 |
# File 'app/models/terraform/state.rb', line 35 def latest_file latest_version&.file end |
#locked? ⇒ Boolean
39 40 41 |
# File 'app/models/terraform/state.rb', line 39 def locked? self.lock_xid.present? end |
#update_file!(data, version:, build:) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/models/terraform/state.rb', line 43 def update_file!(data, version:, build:) # This check is required to maintain backwards compatibility with # states that were created prior to versioning being supported. # This can be removed in 14.0 when support for these states is dropped. # See https://gitlab.com/gitlab-org/gitlab/-/issues/258960 if versioning_enabled? create_new_version!(data: data, version: version, build: build) else migrate_legacy_version!(data: data, version: version, build: build) end end |