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
This commit is contained in:

committed by
Tuan Luong-Anh

parent
28da1ca05a
commit
81780adef8
ironic_python_agent
@@ -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):
|
||||
|
Reference in New Issue
Block a user