Merge "Use oslo_serialization.base64 to follow OpenStack Python3"
This commit is contained in:
commit
a6b09f2fa8
ironic_python_agent
@ -13,7 +13,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import base64
|
|
||||||
import errno
|
import errno
|
||||||
import glob
|
import glob
|
||||||
import io
|
import io
|
||||||
@ -27,6 +26,7 @@ import testtools
|
|||||||
from ironic_lib import utils as ironic_utils
|
from ironic_lib import utils as ironic_utils
|
||||||
import mock
|
import mock
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
|
from oslo_serialization import base64
|
||||||
from oslotest import base as test_base
|
from oslotest import base as test_base
|
||||||
|
|
||||||
from ironic_python_agent import errors
|
from ironic_python_agent import errors
|
||||||
@ -386,7 +386,7 @@ class TestUtils(testtools.TestCase):
|
|||||||
io_dict = {'fake-name': io.BytesIO(bytes(contents))}
|
io_dict = {'fake-name': io.BytesIO(bytes(contents))}
|
||||||
data = utils.gzip_and_b64encode(io_dict=io_dict)
|
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:
|
with tarfile.open(fileobj=res) as tar:
|
||||||
members = [(m.name, m.size) for m in tar]
|
members = [(m.name, m.size) for m in tar]
|
||||||
self.assertEqual([('fake-name', len(contents))], members)
|
self.assertEqual([('fake-name', len(contents))], members)
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import base64
|
|
||||||
import copy
|
import copy
|
||||||
import errno
|
import errno
|
||||||
import glob
|
import glob
|
||||||
@ -27,6 +26,7 @@ import time
|
|||||||
from ironic_lib import utils as ironic_utils
|
from ironic_lib import utils as ironic_utils
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_serialization import base64
|
||||||
from oslo_utils import units
|
from oslo_utils import units
|
||||||
from six.moves.urllib import parse
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
@ -383,7 +383,7 @@ def gzip_and_b64encode(io_dict=None, file_list=None):
|
|||||||
tar.add(f)
|
tar.add(f)
|
||||||
|
|
||||||
fp.seek(0)
|
fp.seek(0)
|
||||||
return base64.b64encode(fp.getvalue())
|
return base64.encode_as_bytes(fp.getvalue())
|
||||||
|
|
||||||
|
|
||||||
def collect_system_logs(journald_max_lines=None):
|
def collect_system_logs(journald_max_lines=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user