object_store.create_object failing on log file writing

Bug #1485054 reported by Brian Curtin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack SDK
In Progress
Critical
Brian Curtin

Bug Description

create_object is failing on two things:

1. It's not converting container.Container instances into their names during URL creation. This fix is easy, the proxy needs to do the from_id check that we do anywhere else. Other object related calls need this same work.

2. Transport._log_request is attempting to log the bytes data we're transmitting in the PUT request. For two reasons, we can't do that: 1) it's binary data in general, 2) it's a huge amount of characters that are not directly helpful and also wreck readability for the log file. There are some pieces of binary data we can attempt to log, such as the JSON we send for credentials, so we can try to decode the bytes into ascii and log that, but otherwise we need to just insert some placeholder to specify that a chunk of binary data was sent.

Changed in python-openstacksdk:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstacksdk (master)

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

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

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

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

Reviewed: https://review.openstack.org/213247
Committed: https://git.openstack.org/cgit/stackforge/python-openstacksdk/commit/?id=9524fdf7a6b9a4e66e8a28003bd32f072debb431
Submitter: Jenkins
Branch: master

commit 9524fdf7a6b9a4e66e8a28003bd32f072debb431
Author: Brian Curtin <email address hidden>
Date: Fri Aug 14 11:50:24 2015 -0500

    Only log text strings in requests

    As was exposed by object_store.create_object, we were attempting to mix
    text and bytes in log messages, which was causing _logger.debug to choke
    when combining the parts of the message, specifically the --data piece.

    This is an issue for two reasons:
    1. It's binary data in general
    2. It's a very large amount of binary data

    The fix is to not log byte strings that come in as `data` unless we can
    decode them to ascii. This will allow us to continue logging some data
    such as auth credentials, but we won't be logging megabytes or gigabytes
    worth of binary data - such as objects being uploaded to Swift - into
    the log file.

    Change-Id: Iba49552b8ebc58a46cedf826751193a1fa7feb11
    Partial-Bug: 1485054

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

Reviewed: https://review.openstack.org/213278
Committed: https://git.openstack.org/cgit/stackforge/python-openstacksdk/commit/?id=15336d1e73a474099ce9a21612f8d345c79a4a90
Submitter: Jenkins
Branch: master

commit 15336d1e73a474099ce9a21612f8d345c79a4a90
Author: Brian Curtin <email address hidden>
Date: Fri Aug 14 12:13:35 2015 -0500

    Properly pass on Container in path_args

    Once we moved object_store from its own form of proxy to using the
    BaseProxy methods, we lost proper handling of the container during
    object-related operations. We need to pass on container.name, not the
    full container object, so when instances were passed in a URL would be
    created with the repr of an actual Container, which clearly doesn't
    work.

    There's an additional safety check in create_object to make sure a
    container is passed in before trying an operation that won't work and
    then raise a confusing exception.

    Partial-Bug: 1485054

    Change-Id: I85bb6f3b09a9617395dba0fd9becb62a8c4d7e68

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.