Comment 9 for bug 1534568

Revision history for this message
Fuel Devops McRobotson (fuel-devops-robot) wrote : Fix merged to openstack/python-novaclient (openstack-ci/fuel-7.0/2015.1.0)

Reviewed: https://review.fuel-infra.org/17217
Submitter: Vitaly Sedelnik <email address hidden>
Branch: openstack-ci/fuel-7.0/2015.1.0

Commit: c7e5105ef0174c2c309e8100c7d033509da90dd2
Author: melanie witt <email address hidden>
Date: Thu Feb 18 15:55:34 2016

Handle binary userdata files such as gzip

The current code in the servers api assumes only text files will be
provided as userdata. That is, the data is utf-8 encoded before it
is base64 encoded and sent. This breaks for binary userdata files,
(example, gzip files) as they can't be utf-8 encoded.

This change ignores specifically the exceptions that are raised
when utf-8 encoding is attempted on non-text data: AttributeError
and UnicodeDecodeError. These exceptions will be ignored to let
binary files proceed to the base64 encoding step.

Partial-Bug: #1534568
(cherry picked from commit 19d4d35a4e87598f2ec0115753b147552870ceb7)

Change-Id: I3aaab50e6153a2e98002a3ad875de73a1ecd5b80