FIX: Update database_restorer to avoid shell use (#12731)

Follow-up to 0ec5fd5262
This commit is contained in:
David Taylor 2021-04-16 13:39:45 +01:00 committed by GitHub
parent 965843f3e5
commit 3436fef5e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -136,7 +136,7 @@ module BackupRestore
"SKIP_OPTIMIZE_ICONS" => "1",
"DISABLE_TRANSLATION_OVERRIDES" => "1"
},
"rake db:migrate",
"rake", "db:migrate",
failure_message: "Failed to migrate database.",
chdir: Rails.root
)

View File

@ -35,11 +35,11 @@ describe BackupRestore::DatabaseRestorer do
end
def expect_db_migrate
Discourse::Utils.expects(:execute_command).with do |env, command, options|
Discourse::Utils.expects(:execute_command).with do |env, *command, **options|
env["SKIP_POST_DEPLOYMENT_MIGRATIONS"] == "0" &&
env["SKIP_OPTIMIZE_ICONS"] == "1" &&
env["DISABLE_TRANSLATION_OVERRIDES"] == "1" &&
command == "rake db:migrate" &&
command == ["rake", "db:migrate"] &&
options[:chdir] == Rails.root
end.once
end