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.
This commit is contained in:
Chris Butler 2018-10-11 08:57:57 +01:00 committed by Régis Hanol
parent 6275e745a7
commit ddbed82bca

View File

@ -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