github.com/dustinrc/deis@v1.10.1-0.20150917223407-0894a5fb979e/controller/api/management/commands/load_db_state_to_etcd.py (about)

     1  from django.core.management.base import BaseCommand
     2  
     3  from api.models import Key, App, Domain, Certificate, Config
     4  
     5  
     6  class Command(BaseCommand):
     7      """Management command for publishing Deis platform state from the database
     8      to etcd.
     9      """
    10      def handle(self, *args, **options):
    11          """Publishes Deis platform state from the database to etcd."""
    12          print "Publishing DB state to etcd..."
    13          for model in (Key, App, Domain, Certificate, Config):
    14              for obj in model.objects.all():
    15                  obj.save()
    16          print "Done Publishing DB state to etcd."