Skip to content

Commit 46a72ef

Browse files
author
Matthew Fisher
committed
feat(controller): set app dir in etcd
If you add or remove the app from the controller, the corresponding etcd key is not modified. This ensures that the etcd keyspace is created/removed when an app is modified in the database.
1 parent e376f23 commit 46a72ef

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

controller/api/models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,16 @@ def _etcd_purge_user(**kwargs):
626626
pass
627627

628628

629+
def _etcd_create_app(**kwargs):
630+
appname = kwargs['instance']
631+
_etcd_client.write('/deis/services/{}'.format(appname), None, dir=True)
632+
633+
634+
def _etcd_purge_app(**kwargs):
635+
appname = kwargs['instance']
636+
_etcd_client.delete('/deis/services/{}'.format(appname), dir=True, recursive=True)
637+
638+
629639
def _etcd_publish_domains(**kwargs):
630640
app = kwargs['instance'].app
631641
app_domains = app.domain_set.all()
@@ -664,3 +674,5 @@ def _save_transition(**kwargs):
664674
post_delete.connect(_etcd_purge_user, sender=User, dispatch_uid='api.models')
665675
post_save.connect(_etcd_publish_domains, sender=Domain, dispatch_uid='api.models')
666676
post_delete.connect(_etcd_publish_domains, sender=Domain, dispatch_uid='api.models')
677+
post_save.connect(_etcd_create_app, sender=App, dispatch_uid='api.models')
678+
post_delete.connect(_etcd_purge_app, sender=App, dispatch_uid='api.models')

0 commit comments

Comments
 (0)