Skip to content

Commit 33f72a1

Browse files
committed
fix(controller): restore App.destroy() and call delete()
The change in deis/deis#839 didn't account for Django REST framework methods that indirectly call delete(). Fixes #927.
1 parent df7a2c6 commit 33f72a1

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

controller/api/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ def deploy(self, release):
134134
self.save()
135135
self.scale()
136136

137+
def destroy(self, *args, **kwargs):
138+
return self.delete(*args, **kwargs)
139+
137140
def scale(self, **kwargs):
138141
"""Scale containers up or down to match requested."""
139142
requested_containers = self.structure.copy()

controller/api/tests/test_cluster.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ def test_cluster(self):
4545
response = self.client.get('/api/clusters')
4646
self.assertEqual(response.status_code, 200)
4747
self.assertEqual(len(response.data['results']), 1)
48+
# ensure we can delete the cluster with an app
49+
# see https://github.com/deis/deis/issues/927
50+
url = '/api/apps'
51+
body = {'cluster': 'autotest'}
52+
response = self.client.post(url, json.dumps(body), content_type='application/json')
53+
self.assertEqual(response.status_code, 201)
4854
url = '/api/clusters/{cluster_id}'.format(**locals())
4955
response = self.client.get(url)
5056
self.assertEqual(response.status_code, 200)

0 commit comments

Comments
 (0)