Skip to content

Commit d63aa6d

Browse files
author
Matthew Fisher
committed
fix(controller): retrieve logs via GET request
1 parent e310501 commit d63aa6d

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

client/deis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ def apps_logs(self, args):
621621
app = args.get('--app')
622622
if not app:
623623
app = self._session.app
624-
response = self._dispatch('post',
624+
response = self._dispatch('get',
625625
"/api/apps/{}/logs".format(app))
626626
if response.status_code == requests.codes.ok: # @UndefinedVariable
627627
# strip the last newline character

controller/api/tests/test_app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ def test_app_actions(self):
7979
if os.path.exists(path):
8080
os.remove(path)
8181
url = '/api/apps/{app_id}/logs'.format(**locals())
82-
response = self.client.post(url)
82+
response = self.client.get(url)
8383
self.assertEqual(response.status_code, 204)
8484
self.assertEqual(response.data, 'No logs for {}'.format(app_id))
8585
# write out some fake log data and try again
8686
with open(path, 'a') as f:
8787
f.write(FAKE_LOG_DATA)
88-
response = self.client.post(url)
88+
response = self.client.get(url)
8989
self.assertEqual(response.status_code, 200)
9090
self.assertEqual(response.data, FAKE_LOG_DATA)
9191
os.remove(path)
@@ -107,7 +107,7 @@ def test_app_release_notes_in_logs(self):
107107
app_id = response.data['id'] # noqa
108108
path = os.path.join(settings.DEIS_LOG_DIR, app_id + '.log')
109109
url = '/api/apps/{app_id}/logs'.format(**locals())
110-
response = self.client.post(url)
110+
response = self.client.get(url)
111111
self.assertIn('autotest created initial release', response.data)
112112
self.assertEqual(response.status_code, 200)
113113
# delete file for future runs
@@ -170,7 +170,7 @@ def test_admin_can_manage_other_apps(self):
170170
self.assertEqual(response.status_code, 200)
171171
# check app logs
172172
url = '/api/apps/{app_id}/logs'.format(**locals())
173-
response = self.client.post(url)
173+
response = self.client.get(url)
174174
self.assertEqual(response.status_code, 200)
175175
self.assertIn('autotest2 created initial release', response.data)
176176
# run one-off commands

controller/api/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
See also
120120
:meth:`AppViewSet.scale() <api.views.AppViewSet.scale>`
121121
122-
.. http:post:: /api/apps/(string:id)/logs/
122+
.. http:get:: /api/apps/(string:id)/logs/
123123
124124
See also
125125
:meth:`AppViewSet.logs() <api.views.AppViewSet.logs>`
@@ -276,7 +276,7 @@
276276
url(r'^apps/(?P<id>{})/scale/?'.format(settings.APP_URL_REGEX),
277277
views.AppViewSet.as_view({'post': 'scale'})),
278278
url(r'^apps/(?P<id>{})/logs/?'.format(settings.APP_URL_REGEX),
279-
views.AppViewSet.as_view({'post': 'logs'})),
279+
views.AppViewSet.as_view({'get': 'logs'})),
280280
url(r'^apps/(?P<id>{})/run/?'.format(settings.APP_URL_REGEX),
281281
views.AppViewSet.as_view({'post': 'run'})),
282282
# apps sharing

0 commit comments

Comments
 (0)