Merge "Use oslo_serialization.base64 to follow OpenStack Python3"

This commit is contained in:
Jenkins 2017-01-02 16:57:44 +00:00 committed by Gerrit Code Review
commit a6b09f2fa8
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import base64
import errno
import glob
import io
@ -27,6 +26,7 @@ import testtools
from ironic_lib import utils as ironic_utils
import mock
from oslo_concurrency import processutils
from oslo_serialization import base64
from oslotest import base as test_base
from ironic_python_agent import errors
@ -386,7 +386,7 @@ class TestUtils(testtools.TestCase):
io_dict = {'fake-name': io.BytesIO(bytes(contents))}
data = utils.gzip_and_b64encode(io_dict=io_dict)
res = io.BytesIO(base64.b64decode(data))
res = io.BytesIO(base64.decode_as_bytes(data))
with tarfile.open(fileobj=res) as tar:
members = [(m.name, m.size) for m in tar]
self.assertEqual([('fake-name', len(contents))], members)

View File

@ -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):