Implicit reason for operation definition check result

Bug #1716226 reported by Eric Xie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Karbor
Fix Released
Undecided
Eric Xie

Bug Description

In https://github.com/openstack/karbor/blob/master/karbor/services/operationengine/operations/protect_operation.py#L28
    def check_operation_definition(self, operation_definition):
        provider_id = operation_definition.get("provider_id")
        if not provider_id or not uuidutils.is_uuid_like(provider_id):
            reason = _("Provider_id is invalid")
            raise exception.InvalidOperationDefinition(reason=reason)

        plan_id = operation_definition.get("plan_id")
        if not plan_id or not uuidutils.is_uuid_like(plan_id):
            reason = _("Plan_id is invalid")
            raise exception.InvalidOperationDefinition(reason=reason)

        plan = objects.Plan.get_by_id(context.get_admin_context(), plan_id)
        if provider_id != plan.provider_id:
            reason = _("Provider_id is invalid")
            raise exception.InvalidOperationDefinition(reason=reason)
For provider_id, the first and third reason were same so that can not show the explicit reason for user.

Eric Xie (eric-xie)
Changed in karbor:
status: New → In Progress
assignee: nobody → Eric Xie (eric-xie)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to karbor (master)

Fix proposed to branch: master
Review: https://review.openstack.org/502400

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to karbor (master)

Reviewed: https://review.openstack.org/502400
Committed: https://git.openstack.org/cgit/openstack/karbor/commit/?id=73058d031668c153329067b8a19c73332b6eeb20
Submitter: Jenkins
Branch: master

commit 73058d031668c153329067b8a19c73332b6eeb20
Author: ericxiett <eric_xiett@163.com>
Date: Mon Sep 11 14:54:25 2017 +0800

    Fix implicit reason for 'provider_id'.

    The reasons are the same while checking 'provider_id' of
    operation_definition. But they are two different cases.
    So fix it in this patch.

    Change-Id: Id92f1b16d8dc59975c7f2e8d1fefe3f6f58558ec
    Closes-Bug: #1716226

Changed in karbor:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 0.6.0

This issue was fixed in the openstack/karbor 0.6.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 1.0.0

This issue was fixed in the openstack/karbor 1.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 1.1.0

This issue was fixed in the openstack/karbor 1.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.