compute_signature method failed if metadata keys contain unicode

Bug #1391517 reported by Ilya Tyaptin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
Ilya Tyaptin
Juno
Fix Released
High
Eoghan Glynn

Bug Description

Unlike fixed sample keys as counter_name and counter_volume, metadata keys may contain a unicode in keys. ceilometer.publisher_utils.compute_signature can't calculate signature of unicode symbols and crashes. So we should encode keys when signature is computed.

Traceback (most recent call last):
  File "ceilometer/tests/base.py", line 99, in skip_if_not_implemented
    return func(*args, **kwargs)
  File "ceilometer/tests/api/v2/test_list_meters_scenarios.py", line 182, in setUp
    self.CONF.publisher.metering_secret)
  File "ceilometer/publisher/utils.py", line 122, in meter_message_from_counter
    msg['message_signature'] = compute_signature(msg, secret)
  File "ceilometer/publisher/utils.py", line 51, in compute_signature
    digest_maker.update(name)
  File "/usr/lib/python2.7/hmac.py", line 83, in update
    self.inner.update(msg)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 30-31: ordinal not in range(128)
}}}

Ilya Tyaptin (ityaptin)
Changed in ceilometer:
assignee: nobody → Ilya Tyaptin (ityaptin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

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

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

Reviewed: https://review.openstack.org/133707
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=05276690525d76e18769712bc66d0cd535b11f18
Submitter: Jenkins
Branch: master

commit 05276690525d76e18769712bc66d0cd535b11f18
Author: Ilya Tyaptin <email address hidden>
Date: Tue Nov 11 17:17:04 2014 +0400

    Add encoding to keys in compute_signature

    Unlike fixed sample keys as counter_name and counter_volume,
    metadata keys may contain unicode characters.
    ceilometer.publisher.utils.compute_signature can't calculate
    signature of unicode symbols and crashes.
    In this patch encoding keys is added.

    Change-Id: I94d02ce20999510e9c6aaf33f7ee503bbb350e87
    Closes-bug: #1391517

Changed in ceilometer:
status: In Progress → Fix Committed
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → kilo-1
Eoghan Glynn (eglynn)
Changed in ceilometer:
importance: Undecided → High
Eoghan Glynn (eglynn)
tags: added: juno-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/137680

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/juno)

Reviewed: https://review.openstack.org/137680
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=ca52652e5a14f2332bd91b0c5a57e98af872c8db
Submitter: Jenkins
Branch: stable/juno

commit ca52652e5a14f2332bd91b0c5a57e98af872c8db
Author: Ilya Tyaptin <email address hidden>
Date: Tue Nov 11 17:17:04 2014 +0400

    Add encoding to keys in compute_signature

    Unlike fixed sample keys as counter_name and counter_volume,
    metadata keys may contain unicode characters.
    ceilometer.publisher.utils.compute_signature can't calculate
    signature of unicode symbols and crashes.
    In this patch encoding keys is added.

    Change-Id: I94d02ce20999510e9c6aaf33f7ee503bbb350e87
    Closes-bug: #1391517
    (cherry picked from commit 05276690525d76e18769712bc66d0cd535b11f18)

tags: added: in-stable-juno
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-1 → 2015.1.0
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.