22from django .shortcuts import get_object_or_404
33
44from api .models import Key , App , Domain , Certificate , Config
5+ from api .exceptions import DeisException
56
67
78class Command (BaseCommand ):
@@ -13,7 +14,11 @@ def handle(self, *args, **options):
1314 print ("Publishing DB state to kubernetes..." )
1415 for model in (Key , App , Domain , Certificate , Config ):
1516 for obj in model .objects .all ():
16- obj .save ()
17+ try :
18+ obj .save ()
19+ except DeisException as error :
20+ print ('ERROR: Problem saving to model {} for {}'
21+ 'due to {}' .format (str (model .__name__ ), str (obj ), str (error )))
1722
1823 # certificates have to be attached to domains to create k8s secrets
1924 for cert in Certificate .objects .all ():
@@ -29,6 +34,11 @@ def handle(self, *args, **options):
2934 print ('WARNING: {} has no build associated with '
3035 'its latest release. Skipping deployment...' .format (application ))
3136 continue
32- application .deploy (rel )
37+
38+ try :
39+ application .deploy (rel )
40+ except DeisException as error :
41+ print ('ERROR: There was a problem deploying {} '
42+ 'due to {}' .format (application , str (error )))
3343
3444 print ("Done Publishing DB state to kubernetes." )
0 commit comments