diff options
| author | Luong Anh Tuan <tuanla@vn.fujitsu.com> | 2016-12-15 13:21:53 +0700 |
|---|---|---|
| committer | Tuan Luong-Anh <tuanla@vn.fujitsu.com> | 2016-12-16 04:29:16 +0000 |
| commit | 81780adef861d7a2be6b198589cecc059f0d01a7 (patch) | |
| tree | 0b14eec7e54b3ec3e510a65aa7bc347b4860e8e1 /ironic_python_agent/utils.py | |
| parent | 28da1ca05a45887e659bf92192efc8a9b7f6fe17 (diff) | |
| download | ironic-python-agent-81780adef861d7a2be6b198589cecc059f0d01a7.tar.gz | |
Use oslo_serialization.base64 to follow OpenStack Python3
This patch replaces python standard base64 library call to
oslo_serialization.base64 to follow OpenStack Python3 porting
standard [1].
Use base64 encoding takes 8-bit binary byte data and encodes it. On
Python3, A string is a sequence of Unicode characters thus base64 has
no idea what to do with Unicode data, it's not 8-bit[2]. We use
oslo_serialization.base64 for both python2 and python3.
[1] https://wiki.openstack.org/wiki/Python3
[2] http://stackoverflow.com/questions/8908287/base64-encoding-in-python-3
Change-Id: I1dafe878a71f37d223eaf58ea8e2e8c6b4422a14
Diffstat (limited to 'ironic_python_agent/utils.py')
| -rw-r--r-- | ironic_python_agent/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py index e2ccb681..6045f6b4 100644 --- a/ironic_python_agent/utils.py +++ b/ironic_python_agent/utils.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import base64 import copy import errno import glob @@ -27,6 +26,7 @@ import time from ironic_lib import utils as ironic_utils from oslo_concurrency import processutils from oslo_log import log as logging +from oslo_serialization import base64 from oslo_utils import units from six.moves.urllib import parse @@ -383,7 +383,7 @@ def gzip_and_b64encode(io_dict=None, file_list=None): tar.add(f) fp.seek(0) - return base64.b64encode(fp.getvalue()) + return base64.encode_as_bytes(fp.getvalue()) def collect_system_logs(journald_max_lines=None): |
