Class: Gitlab::Doctor::ResetTokens
- Inherits:
-
Object
- Object
- Gitlab::Doctor::ResetTokens
- Defined in:
- lib/gitlab/doctor/reset_tokens.rb
Constant Summary collapse
- PRINT_PROGRESS_EVERY =
1000
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger, model_names:, token_names:, dry_run: true) ⇒ ResetTokens
constructor
A new instance of ResetTokens.
- #run! ⇒ Object
Constructor Details
#initialize(logger, model_names:, token_names:, dry_run: true) ⇒ ResetTokens
Returns a new instance of ResetTokens.
10 11 12 13 14 15 |
# File 'lib/gitlab/doctor/reset_tokens.rb', line 10 def initialize(logger, model_names:, token_names:, dry_run: true) @logger = logger @model_names = model_names @token_names = token_names @dry_run = dry_run end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
6 7 8 |
# File 'lib/gitlab/doctor/reset_tokens.rb', line 6 def logger @logger end |
Instance Method Details
#run! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/doctor/reset_tokens.rb', line 17 def run! logger.info "Resetting #{@token_names.join(', ')} on #{@model_names.join(', ')} if they can not be read" logger.info "Executing in DRY RUN mode, no records will actually be updated" if @dry_run Rails.application.eager_load! models_with_encrypted_tokens.each do |model| fix_model(model) end logger.info "Done!" end |