From: Alfredo Deza Date: Fri, 18 Jan 2019 17:50:38 +0000 (-0500) Subject: ceph-volume util.encryption ensure int is used for urandom (py3 compat) X-Git-Tag: v13.2.5~131^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cf122efaef41f1215d0b111dff6996e375d03054;p=ceph.git ceph-volume util.encryption ensure int is used for urandom (py3 compat) Signed-off-by: Alfredo Deza (cherry picked from commit 0ab9fa62d6d46464b16f08d3a5bb3da50f5030e7) --- diff --git a/src/ceph-volume/ceph_volume/util/encryption.py b/src/ceph-volume/ceph_volume/util/encryption.py index 54683d1810c1..e2b3ca164642 100644 --- a/src/ceph-volume/ceph_volume/util/encryption.py +++ b/src/ceph-volume/ceph_volume/util/encryption.py @@ -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