]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume util.encryption ensure int is used for urandom (py3 compat)
authorAlfredo Deza <adeza@redhat.com>
Fri, 18 Jan 2019 17:50:38 +0000 (12:50 -0500)
committerAlfredo Deza <adeza@redhat.com>
Thu, 24 Jan 2019 13:51:34 +0000 (08:51 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 0ab9fa62d6d46464b16f08d3a5bb3da50f5030e7)

src/ceph-volume/ceph_volume/util/encryption.py

index 54683d1810c1bdced81a2bc5edc82d3ee310ae45..e2b3ca1646423287b9babd3dae958393758e22e1 100644 (file)
@@ -23,7 +23,7 @@ def create_dmcrypt_key():
     )
     # The size of the key is defined in bits, so we must transform that
     # value to bytes (dividing by 8) because we read in bytes, not bits
-    random_string = os.urandom(dmcrypt_key_size / 8)
+    random_string = os.urandom(int(dmcrypt_key_size / 8))
     key = base64.b64encode(random_string).decode('utf-8')
     return key