Browse Source

Replace @content decorator with all that madness

Change Ia3da3bd809bcca923d53666eca54def78c995f65 broke our handlers as
it incorporated destructive changes to all handlers.

Change-Id: I688e833b1fb8b658f01b7f858a140c315fa513a2
Yuriy Taraday 2 years ago
parent
commit
6150aaca88
2 changed files with 10 additions and 6 deletions
  1. 8
    4
      cluster_upgrade/handlers.py
  2. 2
    2
      cluster_upgrade/objects/adapters.py

+ 8
- 4
cluster_upgrade/handlers.py View File

@@ -29,7 +29,9 @@ class ClusterUpgradeCloneHandler(base.BaseHandler):
29 29
     single = objects.Cluster
30 30
     validator = validators.ClusterUpgradeValidator
31 31
 
32
-    @base.content
32
+    @base.handle_errors
33
+    @base.validate
34
+    @base.serialize
33 35
     def POST(self, cluster_id):
34 36
         """Initialize the upgrade of the cluster.
35 37
 
@@ -50,7 +52,7 @@ class ClusterUpgradeCloneHandler(base.BaseHandler):
50 52
         request_data = self.checked_data(cluster=orig_cluster)
51 53
         new_cluster = upgrade.UpgradeHelper.clone_cluster(orig_cluster,
52 54
                                                           request_data)
53
-        return new_cluster.to_json()
55
+        return new_cluster.to_dict()
54 56
 
55 57
 
56 58
 class NodeReassignHandler(base.BaseHandler):
@@ -67,7 +69,8 @@ class NodeReassignHandler(base.BaseHandler):
67 69
 
68 70
         self.raise_task(task)
69 71
 
70
-    @base.content
72
+    @base.handle_errors
73
+    @base.validate
71 74
     def POST(self, cluster_id):
72 75
         """Reassign node to the given cluster.
73 76
 
@@ -107,7 +110,8 @@ class CopyVIPsHandler(base.BaseHandler):
107 110
     single = objects.Cluster
108 111
     validator = validators.CopyVIPsValidator
109 112
 
110
-    @base.content
113
+    @base.handle_errors
114
+    @base.validate
111 115
     def POST(self, cluster_id):
112 116
         """Copy VIPs from original cluster to new one
113 117
 

+ 2
- 2
cluster_upgrade/objects/adapters.py View File

@@ -74,8 +74,8 @@ class NailgunClusterAdapter(object):
74 74
             instance=self.cluster)
75 75
         return NailgunNetworkManager(self.cluster, net_manager)
76 76
 
77
-    def to_json(self):
78
-        return objects.Cluster.to_json(self.cluster)
77
+    def to_dict(self):
78
+        return objects.Cluster.to_dict(self.cluster)
79 79
 
80 80
     @classmethod
81 81
     def get_by_uid(cls, cluster_id):

Loading…
Cancel
Save