Browse Source

Plan: send only parameters for protected resources

Change-Id: I0d47d065b3567c0118dcfccfed5d794013f22f0c
Yuval Brik 1 year ago
parent
commit
90437986bc
1 changed files with 11 additions and 5 deletions
  1. 11
    5
      karbor_dashboard/protectionplans/forms.py

+ 11
- 5
karbor_dashboard/protectionplans/forms.py View File

@@ -59,11 +59,17 @@ class CreateProtectionPlanForm(horizon_forms.SelfHandlingForm):
59 59
 
60 60
     def handle(self, request, data):
61 61
         try:
62
-            new_plan = karborclient.plan_create(request,
63
-                                                data["name"],
64
-                                                data["provider_id"],
65
-                                                json.loads(data["resources"]),
66
-                                                json.loads(data["parameters"]))
62
+            resources = json.loads(data["resources"])
63
+            types = {resource["type"] for resource in resources}
64
+            parameters = json.loads(data["parameters"])
65
+            parameters = {k: v for k, v in parameters.items() if k in types}
66
+            new_plan = karborclient.plan_create(
67
+                request,
68
+                data["name"],
69
+                data["provider_id"],
70
+                resources,
71
+                parameters,
72
+            )
67 73
 
68 74
             messages.success(request,
69 75
                              _("Protection Plan created successfully."))

Loading…
Cancel
Save