Class: Gitlab::BackgroundMigration::FillValidTimeForPagesDomainCertificate

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/fill_valid_time_for_pages_domain_certificate.rb

Overview

save validity time pages domain

Defined Under Namespace

Classes: PagesDomain

Instance Method Summary collapse

Instance Method Details

#perform(start_id, stop_id) ⇒ Object


20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gitlab/background_migration/fill_valid_time_for_pages_domain_certificate.rb', line 20

def perform(start_id, stop_id)
  PagesDomain.where(id: start_id..stop_id).find_each do |domain|
    # for some reason activerecord doesn't append timezone, iso8601 forces this
    domain.update_columns(
      certificate_valid_not_before: domain.x509&.not_before&.iso8601,
      certificate_valid_not_after: domain.x509&.not_after&.iso8601
    )
  rescue => e
    Gitlab::AppLogger.error "Failed to update pages domain certificate valid time. id: #{domain.id}, message: #{e.message}"
  end
end