プロジェクト

全般

プロフィール

Vote #81036

完了

Rake tasks "db:encrypt" and "db:decrypt" may fail due to validation error

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Accounts / authentication_7
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
7
version_id:
161
issue_org_id:
33926
author_id:
332
assigned_to_id:
332
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

@encrypt_all@ and @decrypt_all@ methods in @lib/redmine/ciphering.rb@ are expected to skip validation when saving an object. But they don't because of typo in parameter name.

It may cause a failure to run @rake db:encrypt@ or @rake db:decrypt@. You can reproduce it by running the following commands.

$ bin/rake db:fixtures:load
$ bin/rake db:encrypt
rake aborted!
Some objects could not be saved after encryption, update was rolled back.

Here is a fix:


diff --git a/lib/redmine/ciphering.rb b/lib/redmine/ciphering.rb
index d5ceb0c6c..469d3b9e6 100644
--- a/lib/redmine/ciphering.rb
+++ b/lib/redmine/ciphering.rb
@@ -74,7 +74,7 @@ module Redmine
           all.each do |object|
             clear = object.send(attribute)
             object.send "#{attribute}=", clear
-            raise(ActiveRecord::Rollback) unless object.save(:validation => false)
+            raise(ActiveRecord::Rollback) unless object.save(validate: false)
           end
         end ? true : false
       end
@@ -84,7 +84,7 @@ module Redmine
           all.each do |object|
             clear = object.send(attribute)
             object.send :write_attribute, attribute, clear
-            raise(ActiveRecord::Rollback) unless object.save(:validation => false)
+            raise(ActiveRecord::Rollback) unless object.save(validate: false)
           end
         end ? true : false
       end

journals

--------------------------------------------------------------------------------
Added test code.
--------------------------------------------------------------------------------
Setting the target version to 4.0.8.
--------------------------------------------------------------------------------
Committed the patch.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリAccounts / authentication_7 にセット
  • 対象バージョン4.0.8_161 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0