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
This commit is contained in:
@@ -56,16 +56,11 @@ class CreateProtectionPlanForm(horizon_forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
keys = [u'id', u'status', u'provider_id',
|
|
||||||
u'name', u'parameters', u'resources']
|
|
||||||
new_plan = smaugclient.plan_create(request,
|
new_plan = smaugclient.plan_create(request,
|
||||||
data["name"],
|
data["name"],
|
||||||
data["provider_id"],
|
data["provider_id"],
|
||||||
json.loads(data["resources"]),
|
json.loads(data["resources"]),
|
||||||
json.loads(data["parameters"]))
|
json.loads(data["parameters"]))
|
||||||
if set(keys) > set(new_plan.keys()):
|
|
||||||
smaugclient.plan_delete(request, new_plan['id'])
|
|
||||||
raise Exception()
|
|
||||||
|
|
||||||
messages.success(request,
|
messages.success(request,
|
||||||
_("Protection Plan created successfully."))
|
_("Protection Plan created successfully."))
|
||||||
@@ -73,10 +68,10 @@ class CreateProtectionPlanForm(horizon_forms.SelfHandlingForm):
|
|||||||
if data["actionmode"] == "schedule":
|
if data["actionmode"] == "schedule":
|
||||||
request.method = 'GET'
|
request.method = 'GET'
|
||||||
return self.next_view.as_view()(request,
|
return self.next_view.as_view()(request,
|
||||||
plan_id=new_plan["id"])
|
plan_id=new_plan.id)
|
||||||
elif data["actionmode"] == "now":
|
elif data["actionmode"] == "now":
|
||||||
smaugclient.checkpoint_create(request, new_plan["provider_id"],
|
smaugclient.checkpoint_create(request, new_plan.provider_id,
|
||||||
new_plan["id"])
|
new_plan.id)
|
||||||
messages.success(request, _("Protect now successfully."))
|
messages.success(request, _("Protect now successfully."))
|
||||||
return new_plan
|
return new_plan
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user