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)
Reviewed: https:/ /review. fuel-infra. org/17217 ci/fuel- 7.0/2015. 1.0
Submitter: Vitaly Sedelnik <email address hidden>
Branch: openstack-
Commit: c7e5105ef0174c2 c309e8100c7d033 509da90dd2
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 f2ec0115753b147 552870ceb7)
(cherry picked from commit 19d4d35a4e87598
Change-Id: I3aaab50e6153a2 e98002a3ad875de 73a1ecd5b80