Browse Source

Merge pull request #28 from denismakogon/drop-confusing-code

Cleanup controllers
Denis Makogon 2 years ago
parent
commit
43184a31a1

+ 1
- 5
picasso/api/controllers/runnable.py View File

@@ -51,11 +51,7 @@ class RunnableMixin(object):
51 51
 
52 52
         def process_result(res):
53 53
             if route.type == "async":
54
-                _data = {
55
-                    "task_id": res["call_id"],
56
-                    "message": ("App {} async route {} "
57
-                                "execution started".format(app, path))
58
-                }
54
+                _data = {}
59 55
             else:
60 56
                 _data = {
61 57
                     "result": res,

+ 0
- 96
picasso/api/controllers/tasks.py View File

@@ -1,96 +0,0 @@
1
-# All Rights Reserved.
2
-#
3
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-#    not use this file except in compliance with the License. You may obtain
5
-#    a copy of the License at
6
-#
7
-#         http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-#    Unless required by applicable law or agreed to in writing, software
10
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-#    License for the specific language governing permissions and limitations
13
-#    under the License.
14
-
15
-from aiohttp import web
16
-
17
-# from ...models import app as app_model
18
-
19
-from aioservice.http import controller
20
-from aioservice.http import requests
21
-
22
-# from ...common import config
23
-
24
-
25
-# TODO(denismakogon): disabled until
26
-# https://github.com/iron-io/functions/issues/275
27
-class TasksV1Controller(controller.ServiceController):
28
-
29
-    controller_name = "tasks"
30
-    version = "v1"
31
-
32
-    # TODO(denismakogon):
33
-    # - define subapp to process requests to tasks API:
34
-    #   * extract tasks V1 controller to subapp
35
-    # - on each request check if route is public our private
36
-    #   * reject with 401 if route is private
37
-    #   * accept with 200 if route is public
38
-    @requests.api_action(
39
-        method='GET', route='{project_id}/tasks')
40
-    async def list(self, request, **kwargs):
41
-        """
42
-        ---
43
-        description: Listing tasks
44
-        tags:
45
-        - Runnable tasks
46
-        produces:
47
-        - application/json
48
-        responses:
49
-            "401":
50
-                description: Not authorized.
51
-            "405":
52
-                description: Not implemented
53
-        """
54
-        # c = config.Config.config_instance()
55
-        # fnclient = c.functions_client
56
-        # project_id = request.match_info.get('project_id')
57
-        # stored_apps = await app_model.Apps.find_by(project_id=project_id)
58
-        # final = []
59
-        # for app in stored_apps:
60
-        #     fn_app = await fnclient.apps.show(app.name, loop=c.event_loop)
61
-
62
-        return web.json_response(data={
63
-            "error": {
64
-                "message": "Not supported"
65
-            }
66
-        }, status=405)
67
-
68
-    @requests.api_action(
69
-        method='GET', route='{project_id}/tasks/{task}')
70
-    async def show(self, request, **kwargs):
71
-        """
72
-        ---
73
-        description: Pulling specific tasks by its ID
74
-        tags:
75
-        - Runnable tasks
76
-        produces:
77
-        - application/json
78
-        responses:
79
-            "401":
80
-                description: Not authorized.
81
-            "405":
82
-                description: Not implemented
83
-        """
84
-        # c = config.Config.config_instance()
85
-        # fnclient = c.functions_client
86
-        # project_id = request.match_info.get('project_id')
87
-        # stored_apps = await app_model.Apps.find_by(project_id=project_id)
88
-        # final = []
89
-        # for app in stored_apps:
90
-        #     fn_app = await fnclient.apps.show(app.name, loop=c.event_loop)
91
-
92
-        return web.json_response(data={
93
-            "error": {
94
-                "message": "Not supported"
95
-            }
96
-        }, status=405)

+ 0
- 2
picasso/tests/functional/base.py View File

@@ -21,7 +21,6 @@ from aioservice.http import service
21 21
 from ...api.controllers import apps
22 22
 from ...api.controllers import routes
23 23
 from ...api.controllers import runnable
24
-from ...api.controllers import tasks
25 24
 from ...api.middleware import content_type
26 25
 
27 26
 from ...common import config
@@ -40,7 +39,6 @@ class FunctionalTestsBase(base.PicassoTestsBase, testtools.TestCase):
40 39
             [
41 40
                 apps.AppV1Controller,
42 41
                 routes.AppRouteV1Controller,
43
-                tasks.TasksV1Controller,
44 42
                 runnable.RunnableV1Controller,
45 43
             ], middleware=[
46 44
                 content_type.content_type_validator

+ 0
- 2
service/picasso_api.py View File

@@ -24,7 +24,6 @@ from aioservice.http import service
24 24
 from picasso.api.controllers import apps
25 25
 from picasso.api.controllers import routes
26 26
 from picasso.api.controllers import runnable
27
-from picasso.api.controllers import tasks
28 27
 
29 28
 from picasso.api.middleware import content_type
30 29
 from picasso.api.middleware import keystone
@@ -48,7 +47,6 @@ class API(service.HTTPService):
48 47
                 apps.AppV1Controller,
49 48
                 routes.AppRouteV1Controller,
50 49
                 runnable.RunnableV1Controller,
51
-                tasks.TasksV1Controller
52 50
             ], middleware=[
53 51
                 keystone.auth_through_token,
54 52
                 content_type.content_type_validator

Loading…
Cancel
Save