From f90be0031ff41f2e08394fb9e885e226cc0f4727 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 5 Feb 2019 11:58:26 -0500 Subject: [PATCH] Don't sys.exit in management commands, in case they get called from other code --- .../djangoapps/catalog/management/commands/cache_programs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/catalog/management/commands/cache_programs.py b/openedx/core/djangoapps/catalog/management/commands/cache_programs.py index 9e83c03a35..1901b0bd67 100644 --- a/openedx/core/djangoapps/catalog/management/commands/cache_programs.py +++ b/openedx/core/djangoapps/catalog/management/commands/cache_programs.py @@ -4,7 +4,7 @@ import sys from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.core.cache import cache -from django.core.management import BaseCommand +from django.core.management import BaseCommand, CommandError from openedx.core.djangoapps.catalog.cache import ( PATHWAY_CACHE_KEY_TPL, @@ -93,7 +93,7 @@ class Command(BaseCommand): if failure: # This will fail a Jenkins job running this command, letting site # operators know that there was a problem. - sys.exit(1) + raise CommandError("Caching program information failed") def get_site_program_uuids(self, client, site): failure = False