Merge "Use oslo_serialization.base64 to follow OpenStack Python3"

This commit is contained in:
Jenkins 2016-12-15 17:47:20 +00:00 committed by Gerrit Code Review
commit 2a80a41c51
3 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,6 @@
"""Handling introspection data from the ramdisk.""" """Handling introspection data from the ramdisk."""
import base64
import copy import copy
import datetime import datetime
import os import os
@ -22,6 +21,7 @@ import eventlet
import json import json
from oslo_config import cfg from oslo_config import cfg
from oslo_serialization import base64
from oslo_utils import excutils from oslo_utils import excutils
from ironic_inspector.common.i18n import _, _LE, _LI, _LW from ironic_inspector.common.i18n import _, _LE, _LI, _LW
@ -74,7 +74,7 @@ def _store_logs(introspection_data, node_info):
os.makedirs(CONF.processing.ramdisk_logs_dir) os.makedirs(CONF.processing.ramdisk_logs_dir)
with open(os.path.join(CONF.processing.ramdisk_logs_dir, file_name), with open(os.path.join(CONF.processing.ramdisk_logs_dir, file_name),
'wb') as fp: 'wb') as fp:
fp.write(base64.b64decode(logs)) fp.write(base64.decode_as_bytes(logs))
except EnvironmentError: except EnvironmentError:
LOG.exception(_LE('Could not store the ramdisk logs'), LOG.exception(_LE('Could not store the ramdisk logs'),
data=introspection_data, node_info=node_info) data=introspection_data, node_info=node_info)

View File

@ -11,7 +11,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 functools import functools
import json import json
@ -25,6 +24,7 @@ import fixtures
from ironicclient import exceptions from ironicclient import exceptions
import mock import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_serialization import base64
from oslo_utils import uuidutils from oslo_utils import uuidutils
from ironic_inspector.common import ironic as ir_utils from ironic_inspector.common import ironic as ir_utils
@ -259,7 +259,7 @@ class TestStoreLogs(BaseProcessTest):
CONF.set_override('ramdisk_logs_dir', self.tempdir, 'processing') CONF.set_override('ramdisk_logs_dir', self.tempdir, 'processing')
self.logs = b'test logs' self.logs = b'test logs'
self.data['logs'] = base64.b64encode(self.logs) self.data['logs'] = base64.encode_as_bytes(self.logs)
def _check_contents(self, name=None): def _check_contents(self, name=None):
files = os.listdir(self.tempdir) files = os.listdir(self.tempdir)

View File

@ -23,6 +23,7 @@ oslo.i18n>=2.1.0 # Apache-2.0
oslo.log>=3.11.0 # Apache-2.0 oslo.log>=3.11.0 # Apache-2.0
oslo.middleware>=3.0.0 # Apache-2.0 oslo.middleware>=3.0.0 # Apache-2.0
oslo.rootwrap>=5.0.0 # Apache-2.0 oslo.rootwrap>=5.0.0 # Apache-2.0
oslo.serialization>=1.10.0 # Apache-2.0
oslo.utils>=3.18.0 # Apache-2.0 oslo.utils>=3.18.0 # Apache-2.0
six>=1.9.0 # MIT six>=1.9.0 # MIT
stevedore>=1.17.1 # Apache-2.0 stevedore>=1.17.1 # Apache-2.0