Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph-volume fix TypeError on dmcrypt when using Python3 #26034

Merged
merged 2 commits into from Jan 24, 2019
Merged

ceph-volume fix TypeError on dmcrypt when using Python3 #26034

merged 2 commits into from Jan 24, 2019

Conversation

alfredodeza
Copy link
Contributor

Alfredo Deza added 2 commits January 18, 2019 12:50
Signed-off-by: Alfredo Deza <adeza@redhat.com>
Signed-off-by: Alfredo Deza <adeza@redhat.com>
@@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's more Pythonic to use // (truncating division) instead of casting to an int later. That works in 2.7 too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting to an int here prevents someone defining a float in dmcrypt_key_size, in which case, the float would be preserved. I would agree that just using // would be preferable otherwise.

@andrewschoen
Copy link
Contributor

jenkins test ceph-volume lvm all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants