nrpe check_swift_storage.py fails when replication_last is null (float expected)

Bug #1673441 reported by Alvaro Uria
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Swift Storage Charm
Fix Released
Undecided
Alvaro Uria

Bug Description

When there is a permissions issue ie. on /var/cache/swift/object.recon (uid/gid=0 instead of swift user), the following command (curl localhost:6000/recon/replication/object) would return:
"""
{"replication_last": null, "replication_stats": null, "object_replication_last": null, "replication_time": null, "object_replication_time": null}
"""

That makes check_swift_storage.py fail:
"""
Traceback (most recent call last):
  File "/usr/local/lib/nagios/plugins/check_swift_storage.py", line 118, in <module>
    results.extend(check_replication(base_url, args.check_replication))
  File "/usr/local/lib/nagios/plugins/check_swift_storage.py", line 74, in check_replication
    repl_last = datetime.datetime.fromtimestamp(j["object_replication_last"])
TypeError: a float is required
"""

nrpe check should catch null values and trigger a critical error.

Revision history for this message
Alvaro Uria (aluria) wrote :
Alvaro Uria (aluria)
Changed in charm-swift-storage:
assignee: nobody → Alvaro Uría (aluria)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-swift-storage (master)

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

Changed in charm-swift-storage:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on charm-swift-storage (master)

Change abandoned by Alvaro Uría (<email address hidden>) on branch: master
Review: https://review.openstack.org/460641
Reason: wrong change-id. Set abandoned in favor of 446490.

Revision history for this message
Alvaro Uria (aluria) wrote :

Change reviewed and pending to be merged:
https://review.openstack.org/#/c/446490/

Changed in charm-swift-storage:
status: In Progress → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-swift-storage (master)

Reviewed: https://review.openstack.org/446490
Committed: https://git.openstack.org/cgit/openstack/charm-swift-storage/commit/?id=d59759259e8537af596976f7f8d8adc02f9e75be
Submitter: Jenkins
Branch: master

commit d59759259e8537af596976f7f8d8adc02f9e75be
Author: Alvaro Uria <email address hidden>
Date: Thu Apr 27 18:50:14 2017 +0200

    Support null values on recon/replication module

    Update on nrpe check check_swift_storage:
     * Refactor check_replication function
     * Raise STATUS_CRIT on null values
     * Clean code per flake8 and previous review
     * Add unit_test for nrpe check check_swift_storage.py

    Change-Id: Ie076b8ea56f66c1e15a9bfe2e400b49f968fa4ed
    Closes-Bug: #1673441
    Signed-off-by: Alvaro Uria <email address hidden>

Changed in charm-swift-storage:
status: Confirmed → Fix Committed
James Page (james-page)
Changed in charm-swift-storage:
milestone: none → 17.08
James Page (james-page)
Changed in charm-swift-storage:
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.