summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gajsin <igajsin@mirantis.com>2017-02-27 16:12:04 +0300
committerIgor Gajsin <igajsin@mirantis.com>2017-03-23 12:26:38 +0300
commitcb8529a84ab25d7942c26766417fa7e37744c7b9 (patch)
treebff5ebc358563e29af749e5e5c7c07a198877e39
parent9fc3e312dc15e0bfab9c3148f277a3b74b2496c7 (diff)
add removed handlers
There were urls and handlers for vmware in the nailgun, that were removed completely in review.openstack.org/#/c/428402/15/nailgun/nailgun/api/v1/urls.py The better approach is remain the urls and make special stub-handlers instead of real ones. Change-Id: I50bf740ec726c9cc57ff63d49aff718e812e6feb Closes-Bug: #1668258
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Aleksey Kasatkin <akasatkin@mirantis.com> Code-Review+2: Alexander Kislitsky <akislitsky@mirantis.com> Workflow+1: Alexander Kislitsky <akislitsky@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 23 Mar 2017 13:18:50 +0000 Reviewed-on: https://review.openstack.org/438487 Project: openstack/fuel-web Branch: refs/heads/master
-rw-r--r--nailgun/nailgun/api/v1/handlers/removed.py26
-rw-r--r--nailgun/nailgun/api/v1/urls.py9
-rw-r--r--nailgun/nailgun/test/unit/test_handlers.py12
3 files changed, 47 insertions, 0 deletions
diff --git a/nailgun/nailgun/api/v1/handlers/removed.py b/nailgun/nailgun/api/v1/handlers/removed.py
index cae367d..7604dd7 100644
--- a/nailgun/nailgun/api/v1/handlers/removed.py
+++ b/nailgun/nailgun/api/v1/handlers/removed.py
@@ -56,3 +56,29 @@ class RemovedIn51RedHatAccountHandler(RemovedIn51Handler):
56 56
57class RemovedIn51RedHatSetupHandler(RemovedIn51Handler): 57class RemovedIn51RedHatSetupHandler(RemovedIn51Handler):
58 pass 58 pass
59
60
61class RemovedIn10Handler(BaseRemovedInHandler):
62 """Removed resource handler for Fuel 10"""
63 fuel_version = "10"
64
65 @handle_errors
66 @validate
67 @serialize
68 def GET(self, cluster_id):
69 """A stub for the request. Always returns 410 with removed message.
70
71 :http: 410 (Gone)
72 :raises: webapi.Gone Exception
73 :return: Removed in Fuel version message
74 """
75 message = u"Removed in Fuel version {0}".format(self.fuel_version)
76 raise self.http(410, message)
77
78
79class RemovedIn10VmwareAttributesDefaultsHandler(RemovedIn10Handler):
80 pass
81
82
83class RemovedIn10VmwareAttributesHandler(RemovedIn10Handler):
84 pass
diff --git a/nailgun/nailgun/api/v1/urls.py b/nailgun/nailgun/api/v1/urls.py
index 9786cad..ada5c9f 100644
--- a/nailgun/nailgun/api/v1/urls.py
+++ b/nailgun/nailgun/api/v1/urls.py
@@ -46,6 +46,10 @@ from nailgun.api.v1.handlers.cluster import ClusterResetHandler
46from nailgun.api.v1.handlers.cluster import ClusterStopDeploymentHandler 46from nailgun.api.v1.handlers.cluster import ClusterStopDeploymentHandler
47from nailgun.api.v1.handlers.component import ComponentCollectionHandler 47from nailgun.api.v1.handlers.component import ComponentCollectionHandler
48 48
49from nailgun.api.v1.handlers.removed import \
50 RemovedIn10VmwareAttributesDefaultsHandler
51from nailgun.api.v1.handlers.removed import RemovedIn10VmwareAttributesHandler
52
49from nailgun.api.v1.handlers.cluster_plugin_link \ 53from nailgun.api.v1.handlers.cluster_plugin_link \
50 import ClusterPluginLinkCollectionHandler 54 import ClusterPluginLinkCollectionHandler
51from nailgun.api.v1.handlers.cluster_plugin_link \ 55from nailgun.api.v1.handlers.cluster_plugin_link \
@@ -268,6 +272,11 @@ urls = (
268 r'/clusters/(?P<cluster_id>\d+)/unassignment/?$', 272 r'/clusters/(?P<cluster_id>\d+)/unassignment/?$',
269 NodeUnassignmentHandler, 273 NodeUnassignmentHandler,
270 274
275 r'/clusters/(?P<cluster_id>\d+)/vmware_attributes/?$',
276 RemovedIn10VmwareAttributesHandler,
277 r'/clusters/(?P<cluster_id>\d+)/vmware_attributes/defaults/?$',
278 RemovedIn10VmwareAttributesDefaultsHandler,
279
271 r'/clusters/(?P<cluster_id>\d+)/plugin_links/?$', 280 r'/clusters/(?P<cluster_id>\d+)/plugin_links/?$',
272 ClusterPluginLinkCollectionHandler, 281 ClusterPluginLinkCollectionHandler,
273 r'/clusters/(?P<cluster_id>\d+)/plugin_links/(?P<obj_id>\d+)/?$', 282 r'/clusters/(?P<cluster_id>\d+)/plugin_links/(?P<obj_id>\d+)/?$',
diff --git a/nailgun/nailgun/test/unit/test_handlers.py b/nailgun/nailgun/test/unit/test_handlers.py
index 6c80f4b..9e55b7b 100644
--- a/nailgun/nailgun/test/unit/test_handlers.py
+++ b/nailgun/nailgun/test/unit/test_handlers.py
@@ -57,6 +57,18 @@ class TestHandlers(BaseIntegrationTest):
57 ) 57 )
58 self.assertIn(resp.status_code, [404, 405]) 58 self.assertIn(resp.status_code, [404, 405])
59 59
60 def test_removed_urls(self):
61 urls = {
62 'RemovedIn51RedHatAccountHandler': {'obj_id', 1},
63 'RemovedIn51RedHatSetupHandler': {'obj_id', 1},
64 'RemovedIn10VmwareAttributesDefaultsHandler': {'cluster_id': 1},
65 'RemovedIn10VmwareAttributesHandler': {'cluster_id': 1},
66 }
67 for handler in urls:
68 test_url = reverse(handler, urls[handler])
69 resp = self.app.get(test_url, expect_errors=True)
70 self.assertEqual(resp.status_code, 410)
71
60 def test_http_response(self): 72 def test_http_response(self):
61 web.ctx.headers = [] 73 web.ctx.headers = []
62 74