Skip to content

Commit a6b09f2

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Use oslo_serialization.base64 to follow OpenStack Python3"
2 parents dbc647c + 81780ad commit a6b09f2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ironic_python_agent/tests/unit/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# License for the specific language governing permissions and limitations
1414
# under the License.
1515

16-
import base64
1716
import errno
1817
import glob
1918
import io
@@ -27,6 +26,7 @@
2726
from ironic_lib import utils as ironic_utils
2827
import mock
2928
from oslo_concurrency import processutils
29+
from oslo_serialization import base64
3030
from oslotest import base as test_base
3131

3232
from ironic_python_agent import errors
@@ -386,7 +386,7 @@ def test_gzip_and_b64encode(self):
386386
io_dict = {'fake-name': io.BytesIO(bytes(contents))}
387387
data = utils.gzip_and_b64encode(io_dict=io_dict)
388388

389-
res = io.BytesIO(base64.b64decode(data))
389+
res = io.BytesIO(base64.decode_as_bytes(data))
390390
with tarfile.open(fileobj=res) as tar:
391391
members = [(m.name, m.size) for m in tar]
392392
self.assertEqual([('fake-name', len(contents))], members)

ironic_python_agent/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import base64
1615
import copy
1716
import errno
1817
import glob
@@ -27,6 +26,7 @@
2726
from ironic_lib import utils as ironic_utils
2827
from oslo_concurrency import processutils
2928
from oslo_log import log as logging
29+
from oslo_serialization import base64
3030
from oslo_utils import units
3131
from six.moves.urllib import parse
3232

@@ -383,7 +383,7 @@ def gzip_and_b64encode(io_dict=None, file_list=None):
383383
tar.add(f)
384384

385385
fp.seek(0)
386-
return base64.b64encode(fp.getvalue())
386+
return base64.encode_as_bytes(fp.getvalue())
387387

388388

389389
def collect_system_logs(journald_max_lines=None):

0 commit comments

Comments
 (0)