diff options
| author | Takashi NATSUME <natsume.takashi@lab.ntt.co.jp> | 2018-10-15 09:00:16 +0900 |
|---|---|---|
| committer | Takashi NATSUME <natsume.takashi@lab.ntt.co.jp> | 2018-10-15 00:41:44 +0000 |
| commit | ece8043ffe9e7df96366a295024e353af41d5fdb (patch) | |
| tree | 678a786bb959d1207462fdc570596c3ab15255e3 /nova/api/validation | |
| parent | 396156eb13521a0e7af4488a8cd4693aa65a0da2 (diff) | |
| download | nova-ece8043ffe9e7df96366a295024e353af41d5fdb.tar.gz | |
Fix deprecated base64.decodestring warning
Replace base64.decodestring with
oslo_serialization.base64.decode_as_bytes.
Change-Id: Ifce0e8d9633f33f12040a1d5a2235cbcb673a436
Closes-Bug: #1797815
Diffstat (limited to 'nova/api/validation')
| -rw-r--r-- | nova/api/validation/validators.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/nova/api/validation/validators.py b/nova/api/validation/validators.py index de3225a050..9537bb9644 100644 --- a/nova/api/validation/validators.py +++ b/nova/api/validation/validators.py @@ -16,12 +16,12 @@ Internal implementation of request Body validating middleware. """ -import base64 import re import jsonschema from jsonschema import exceptions as jsonschema_exc import netaddr +from oslo_serialization import base64 from oslo_utils import timeutils from oslo_utils import uuidutils import rfc3986 @@ -58,9 +58,7 @@ def _validate_base64_format(instance): try: if isinstance(instance, six.text_type): instance = instance.encode('utf-8') - base64.decodestring(instance) - except base64.binascii.Error: - return False + base64.decode_as_bytes(instance) except TypeError: # The name must be string type. If instance isn't string type, the # TypeError will be raised at here. |
