Browse Source

Merge "add removed handlers"

Jenkins 2 years ago
parent
commit
531e275d34

+ 26
- 0
nailgun/nailgun/api/v1/handlers/removed.py View File

@@ -56,3 +56,29 @@ class RemovedIn51RedHatAccountHandler(RemovedIn51Handler):
56 56
 
57 57
 class RemovedIn51RedHatSetupHandler(RemovedIn51Handler):
58 58
     pass
59
+
60
+
61
+class 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
+
79
+class RemovedIn10VmwareAttributesDefaultsHandler(RemovedIn10Handler):
80
+    pass
81
+
82
+
83
+class RemovedIn10VmwareAttributesHandler(RemovedIn10Handler):
84
+    pass

+ 9
- 0
nailgun/nailgun/api/v1/urls.py View File

@@ -46,6 +46,10 @@ from nailgun.api.v1.handlers.cluster import ClusterResetHandler
46 46
 from nailgun.api.v1.handlers.cluster import ClusterStopDeploymentHandler
47 47
 from nailgun.api.v1.handlers.component import ComponentCollectionHandler
48 48
 
49
+from nailgun.api.v1.handlers.removed import \
50
+    RemovedIn10VmwareAttributesDefaultsHandler
51
+from nailgun.api.v1.handlers.removed import RemovedIn10VmwareAttributesHandler
52
+
49 53
 from nailgun.api.v1.handlers.cluster_plugin_link \
50 54
     import ClusterPluginLinkCollectionHandler
51 55
 from nailgun.api.v1.handlers.cluster_plugin_link \
@@ -268,6 +272,11 @@ urls = (
268 272
     r'/clusters/(?P<cluster_id>\d+)/unassignment/?$',
269 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 280
     r'/clusters/(?P<cluster_id>\d+)/plugin_links/?$',
272 281
     ClusterPluginLinkCollectionHandler,
273 282
     r'/clusters/(?P<cluster_id>\d+)/plugin_links/(?P<obj_id>\d+)/?$',

+ 12
- 0
nailgun/nailgun/test/unit/test_handlers.py View File

@@ -57,6 +57,18 @@ class TestHandlers(BaseIntegrationTest):
57 57
             )
58 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 72
     def test_http_response(self):
61 73
         web.ctx.headers = []
62 74
 

Loading…
Cancel
Save