diff options
Diffstat (limited to 'app/models/concerns/packages/debian/distribution.rb')
-rw-r--r-- | app/models/concerns/packages/debian/distribution.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/app/models/concerns/packages/debian/distribution.rb b/app/models/concerns/packages/debian/distribution.rb index 159f0044c82..196bec04be6 100644 --- a/app/models/concerns/packages/debian/distribution.rb +++ b/app/models/concerns/packages/debian/distribution.rb @@ -77,23 +77,16 @@ module Packages validates container_type, presence: true validates :file_store, presence: true - - validates :file_signature, absence: true - validates :signing_keys, absence: true + validates :signed_file_store, presence: true scope :with_container, ->(subject) { where(container_type => subject) } scope :with_codename, ->(codename) { where(codename: codename) } scope :with_suite, ->(suite) { where(suite: suite) } scope :with_codename_or_suite, ->(codename_or_suite) { with_codename(codename_or_suite).or(with_suite(codename_or_suite)) } - attr_encrypted :signing_keys, - mode: :per_attribute_iv, - key: Settings.attr_encrypted_db_key_base_32, - algorithm: 'aes-256-gcm', - encode: false, - encode_iv: false - mount_file_store_uploader Packages::Debian::DistributionReleaseFileUploader + mount_uploader :signed_file, Packages::Debian::DistributionReleaseFileUploader + after_save :update_signed_file_store, if: :saved_change_to_signed_file? def component_names components.pluck(:name).sort @@ -131,6 +124,12 @@ module Packages self.class.with_container(container).with_codename(suite).exists? end + + def update_signed_file_store + # The signed_file.object_store is set during `uploader.store!` + # which happens after object is inserted/updated + self.update_column(:signed_file_store, signed_file.object_store) + end end end end |