summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Brik <yuval@brik.org.il>2017-08-10 09:39:05 +0300
committerYuval Brik <yuval@brik.org.il>2017-08-10 09:39:05 +0300
commit90437986bcd1a49d1e73ada8ed65a9b63721bea2 (patch)
tree66dc35f3ec1565f8c77263e4e8c6d3716a37ceae
parent983e43fe5e031cc5700796938fe2b8ecf791dc7f (diff)
Plan: send only parameters for protected resources
Notes
Notes (review): Code-Review+2: Yuval Brik <yuval@brik.org.il> Code-Review+1: Spencer Yu <yushb@gohighsec.com> Code-Review+2: chenying <ying.chen@huawei.com> Workflow+1: chenying <ying.chen@huawei.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Fri, 11 Aug 2017 02:42:32 +0000 Reviewed-on: https://review.openstack.org/492393 Project: openstack/karbor-dashboard Branch: refs/heads/master
-rw-r--r--karbor_dashboard/protectionplans/forms.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/karbor_dashboard/protectionplans/forms.py b/karbor_dashboard/protectionplans/forms.py
index a99c0fd..c7db1e4 100644
--- a/karbor_dashboard/protectionplans/forms.py
+++ b/karbor_dashboard/protectionplans/forms.py
@@ -59,11 +59,17 @@ class CreateProtectionPlanForm(horizon_forms.SelfHandlingForm):
59 59
60 def handle(self, request, data): 60 def handle(self, request, data):
61 try: 61 try:
62 new_plan = karborclient.plan_create(request, 62 resources = json.loads(data["resources"])
63 data["name"], 63 types = {resource["type"] for resource in resources}
64 data["provider_id"], 64 parameters = json.loads(data["parameters"])
65 json.loads(data["resources"]), 65 parameters = {k: v for k, v in parameters.items() if k in types}
66 json.loads(data["parameters"])) 66 new_plan = karborclient.plan_create(
67 request,
68 data["name"],
69 data["provider_id"],
70 resources,
71 parameters,
72 )
67 73
68 messages.success(request, 74 messages.success(request,
69 _("Protection Plan created successfully.")) 75 _("Protection Plan created successfully."))