ceilometer alarm-threshold-update returns programming error message

Bug #1348387 reported by Eric Pendergrass
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-ceilometerclient
Fix Released
Undecided
Eric Pendergrass

Bug Description

Updating an alarm state via ceilometer client's alarm-threshold-update method returns the following when run by an unauthorized user/tenant pair (non admin who does not own the alarm):

ceilometer alarm-threshold-update -a f4731698-e709-4f0e-85da-629b1eb95fac --enabled False
WARNING (http:173) Request returned failure status.
'NoneType' object has no attribute 'to_dict'

This is a PUT request. On contrary a similar alarm put request to change the alarm state returns a message that the alarm can't be found, which is more expected:

ceilometer alarm-state-set -a f4731698-e709-4f0e-85da-629b1eb95fac --state 'insufficient data'
WARNING (http:173) Request returned failure status.
Alarm not found: f4731698-e709-4f0e-85da-629b1eb95fac

Both commands run fine as admin user and tenant, so there is no problem with syntax or existence of the alarm id.

I would expect the first command to return the same message as the second, that the alarm isn't found (since the user/tenant pair isn't authorized to access it).

Furthermore the error appears to be an uncaught programming error since it references a failed attempted lookup on an object that was expected to be non-None.

Finally, the problem error message is printed for a bogus alarm id as well, and this doesn't seem quite right.

Eric Pendergrass (eap-x)
affects: ceilometer → python-ceilometerclient
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ceilometerclient (master)

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

Changed in python-ceilometerclient:
assignee: nobody → Eric Pendergrass (eap-x)
status: New → In Progress
Eric Pendergrass (eap-x)
Changed in python-ceilometerclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-ceilometerclient (master)

Change abandoned by Eric Pendergrass (<email address hidden>) on branch: master
Review: https://review.openstack.org/110343
Reason: Unfixable commit msg

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Eric Pendergrass (<email address hidden>) on branch: master
Review: https://review.openstack.org/110343
Reason: removed -1

Revision history for this message
Lianhao Lu (lianhao-lu) wrote :

how to reproduce this bug? I created an alarm using admin user, then try to update the alarm using a non-admin user, but the error I got is:

Not Found(HTTP 404)

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

Reviewed: https://review.openstack.org/110345
Committed: https://git.openstack.org/cgit/openstack/python-ceilometerclient/commit/?id=8a01731d4e68152e9f575bea78b2baa085986726
Submitter: Jenkins
Branch: master

commit 8a01731d4e68152e9f575bea78b2baa085986726
Author: Eric Pendergrass <email address hidden>
Date: Tue Jul 29 08:52:20 2014 -0700

    Verify alarm found before modifying

    Current behavior is to retrieve alarm by id and conduct operations on the
    object. If the tenant doesn't own the alarm or isn't admin, the user will
    receive the message: 'NoneType' object has no attribute 'to_dict'

    Above message doesn't provide any useful diagnostic information and indicates a
    programming error since an unexpected None-type is encountered and not handled.

    This change verifies the alarm is found before using the object. If alarm not
    found it prints the same message for a not found Alarm as other PUT operations
    like alarm-state-set: Alarm not found: <alarm_id>.

    This message is more useful for diagnosis and gets rid of the uncaught
    None-type error.

    Change-Id: I66abcd4498b24ac7cadcf29fe3ced3fcda08458c
    Closes-Bug: #1348387

Changed in python-ceilometerclient:
milestone: none → 1.3.0
status: Fix Committed → Fix Released
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.