From cea109e07911ed3d5fa1eaf068d794b706cd6a1b Mon Sep 17 00:00:00 2001 From: xiangxinyong Date: Tue, 16 Aug 2016 22:29:30 +0800 Subject: [PATCH] Fix Protection Plan Creation Failed When we create a protection plan, it throws a exception like "Unable to create protection plan". The reason is that python-smaugclient has changed the return value of protection plan creation. So it needs to update dashboard as well. Change-Id: I1d12fae5c2172f822368ac2bd51b50a049221126 Closes-Bug: #1613689 --- smaug_dashboard/protectionplans/forms.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/smaug_dashboard/protectionplans/forms.py b/smaug_dashboard/protectionplans/forms.py index ef56005..55dc85d 100644 --- a/smaug_dashboard/protectionplans/forms.py +++ b/smaug_dashboard/protectionplans/forms.py @@ -56,16 +56,11 @@ class CreateProtectionPlanForm(horizon_forms.SelfHandlingForm): def handle(self, request, data): try: - keys = [u'id', u'status', u'provider_id', - u'name', u'parameters', u'resources'] new_plan = smaugclient.plan_create(request, data["name"], data["provider_id"], json.loads(data["resources"]), json.loads(data["parameters"])) - if set(keys) > set(new_plan.keys()): - smaugclient.plan_delete(request, new_plan['id']) - raise Exception() messages.success(request, _("Protection Plan created successfully.")) @@ -73,10 +68,10 @@ class CreateProtectionPlanForm(horizon_forms.SelfHandlingForm): if data["actionmode"] == "schedule": request.method = 'GET' return self.next_view.as_view()(request, - plan_id=new_plan["id"]) + plan_id=new_plan.id) elif data["actionmode"] == "now": - smaugclient.checkpoint_create(request, new_plan["provider_id"], - new_plan["id"]) + smaugclient.checkpoint_create(request, new_plan.provider_id, + new_plan.id) messages.success(request, _("Protect now successfully.")) return new_plan except Exception: