]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix last Python 3 issues in zonemanager
authorVictor Stinner <vstinner@redhat.com>
Mon, 15 Feb 2016 17:27:17 +0000 (18:27 +0100)
committerVictor Stinner <vstinner@redhat.com>
Mon, 15 Feb 2016 17:30:26 +0000 (18:30 +0100)
* Replace auth_string.encode("base64", strict") with
  oslo_serialization.base64.encode_as_text(auth_string).
* tests-py3.txt: add cinder.tests.unit.zonemanager, add zonemanager
  unit tests now pass on Python 3

Partial-Implements: blueprint cinder-python3
Change-Id: I527637e182fc3b463bcf5657afbbd129149e7ecc

cinder/zonemanager/drivers/brocade/brcd_http_fc_zone_client.py
tests-py3.txt

index bf3afc4114b8a630417ded5128c88c014878e87d..7e8093314581658f4d2d23c6521fe91b556a3f27 100644 (file)
@@ -19,6 +19,7 @@ HTTP or HTTPS protocol.
 """
 
 from oslo_log import log as logging
+from oslo_serialization import base64
 import requests
 import six
 import time
@@ -158,8 +159,7 @@ class BrcdHTTPFCZoneClient(object):
             # Form the authentication string
             auth_string = (self.switch_user + ":" + self.switch_pwd +
                            ":" + self.random_no)
-            auth_token = auth_string.encode(
-                "base64", "strict").strip()  # encode in base64 format
+            auth_token = base64.encode_as_text(auth_string).strip()
             auth_header = (zone_constant.AUTH_STRING +
                            auth_token)  # Build the proper header
         except Exception as e:
@@ -193,7 +193,7 @@ class BrcdHTTPFCZoneClient(object):
                 # Replace password in the authentication string with xxx
                 auth_string = (self.switch_user +
                                ":" + "xxx" + ":" + self.random_no)
-                auth_token = auth_string.encode("base64", "strict").strip()
+                auth_token = base64.encode_as_text(auth_string).strip()
                 auth_header = zone_constant.AUTH_STRING + auth_token
                 return True, auth_header
             else:
index cc2d520cff9668166b4bb2e6b7d798a10a564166..bd21c6d0e46dafcc976047b75d229e0b3e597c0a 100644 (file)
@@ -175,13 +175,4 @@ cinder.tests.unit.windows.test_windows
 cinder.tests.unit.windows.test_windows_remotefs
 cinder.tests.unit.windows.test_windows_utils
 cinder.tests.unit.wsgi
-cinder.tests.unit.zonemanager.test_brcd_fc_san_lookup_service
-cinder.tests.unit.zonemanager.test_brcd_fc_zone_client_cli
-cinder.tests.unit.zonemanager.test_brcd_fc_zone_driver
-cinder.tests.unit.zonemanager.test_brcd_lookup_service
-cinder.tests.unit.zonemanager.test_cisco_fc_san_lookup_service
-cinder.tests.unit.zonemanager.test_cisco_fc_zone_client_cli
-cinder.tests.unit.zonemanager.test_cisco_fc_zone_driver
-cinder.tests.unit.zonemanager.test_cisco_lookup_service
-cinder.tests.unit.zonemanager.test_fc_zone_manager
-cinder.tests.unit.zonemanager.test_volume_driver
+cinder.tests.unit.zonemanager