summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-23 13:18:50 +0000
committerGerrit Code Review <review@openstack.org>2017-03-23 13:18:50 +0000
commit531e275d348a602fdee6797d0adbddd9ed4f1cd2 (patch)
treef506529d9b721965fbb256e904182e66a331c062
parent2ec2a93d5361238e64fa4ba6d05616037ab8ad87 (diff)
parentcb8529a84ab25d7942c26766417fa7e37744c7b9 (diff)
Merge "add removed handlers"
-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