Skip to content

Commit 405245b

Browse files
author
Gabriel Monroy
committed
deprecate deis-users databag
1 parent ae37b11 commit 405245b

3 files changed

Lines changed: 0 additions & 80 deletions

File tree

api/models.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,6 @@ class Meta:
7878
def __str__(self):
7979
return "{}...{}".format(self.public[:18], self.public[-31:])
8080

81-
def save(self, *args, **kwargs):
82-
super(Key, self).save(*args, **kwargs)
83-
self.owner.publish()
84-
85-
def delete(self, *args, **kwargs):
86-
super(Key, self).delete(*args, **kwargs)
87-
self.owner.publish()
88-
8981

9082
class ProviderManager(models.Manager):
9183
"""Manage database interactions for :class:`Provider`."""
@@ -868,33 +860,6 @@ def new_release(sender, **kwargs):
868860
build=build, version=new_version)
869861
return release
870862

871-
872-
def _user_flat(self):
873-
return {'username': self.username}
874-
875-
876-
def _user_calculate(self):
877-
data = {'id': self.username, 'ssh_keys': {}}
878-
for k in self.key_set.all():
879-
data['ssh_keys'][k.id] = k.public
880-
return data
881-
882-
883-
def _user_publish(self):
884-
CM.publish_user(self.flat(), self.calculate())
885-
886-
887-
def _user_purge(self):
888-
CM.purge_user(self.flat())
889-
890-
891-
# attach to built-in django user
892-
User.flat = _user_flat
893-
User.calculate = _user_calculate
894-
User.publish = _user_publish
895-
User.purge = _user_purge
896-
897-
898863
# define update/delete callbacks for synchronizing
899864
# models with the configuration management backend
900865

cm/chef.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -216,29 +216,6 @@ def converge_formation(formation):
216216
return job.apply_async().join()
217217

218218

219-
def publish_user(user, data):
220-
"""
221-
Publish a user to configuration management.
222-
223-
:param user: a dict containing the username
224-
:param data: data to store with the user
225-
:returns: a tuple of (body, status) from the underlying HTTP response
226-
:raises: RuntimeError
227-
"""
228-
_publish('deis-users', user['username'], data)
229-
230-
231-
def purge_user(user):
232-
"""
233-
Purge a user from configuration management.
234-
235-
:param app: a dict containing the username of the user
236-
:returns: a tuple of (body, status) from the underlying HTTP response
237-
:raises: RuntimeError
238-
"""
239-
_purge('deis-users', user['username'])
240-
241-
242219
def publish_app(app, data):
243220
"""
244221
Publish an app to configuration management.

cm/mock.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,6 @@ def purge_node(node):
8080
pass
8181

8282

83-
def publish_user(user, data):
84-
"""
85-
Publish a user to configuration management.
86-
87-
:param user: a dict containing the username
88-
:param data: data to store with the user
89-
"""
90-
path = os.path.join(settings.TEMPDIR, 'user-{username}'.format(**user))
91-
with open(path, 'w') as f:
92-
f.write(json.dumps(data))
93-
94-
95-
def purge_user(user):
96-
"""
97-
Purge a user from configuration management.
98-
99-
:param user: a dict containing the username
100-
"""
101-
path = os.path.join(settings.TEMPDIR, 'user-{username}'.format(**user))
102-
os.remove(path)
103-
104-
10583
def publish_app(app, data):
10684
"""
10785
Publish an app to configuration management.

0 commit comments

Comments
 (0)