From ddbed82bcafbeb971f7d600932ac0da574a4a69e Mon Sep 17 00:00:00 2001 From: Chris Butler Date: Thu, 11 Oct 2018 08:57:57 +0100 Subject: [PATCH] Exit with an error if there are errors with settings import (#6475) If the site_settings import has any errors or settings that are not found, this will cause the task to exit with a non-zero exit code. This is useful when using this task as part of automated configuration deployment, where you may not want to continue with the process if a setting fails to import. --- lib/tasks/site_settings.rake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tasks/site_settings.rake b/lib/tasks/site_settings.rake index 692cf32b2e2..fd159c1ccf6 100644 --- a/lib/tasks/site_settings.rake +++ b/lib/tasks/site_settings.rake @@ -29,4 +29,8 @@ task "site_settings:import" => :environment do puts " Updated: #{counts[:updated]}" puts " Not Found: #{counts[:not_found]}" puts " Errors: #{counts[:errors]}" + + if counts[:not_found] + counts[:errors] > 0 + exit 1 + end end