github.com/chasestarr/deis@v1.13.5-0.20170519182049-1d9e59fbdbfc/controller/api/management/commands/load_db_state_to_etcd.py (about)

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