-
Notifications
You must be signed in to change notification settings - Fork 128
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
Fix call to Popen.communicate #636
Conversation
@@ -60,7 +60,7 @@ def remove_lvm_physical_volume(block_device): | |||
''' | |||
p = Popen(['pvremove', '-ff', block_device], | |||
stdin=PIPE) | |||
p.communicate(input='y\n') | |||
p.communicate(input=b'y\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whilst I'm generally in agreement here, I'm a little worried this might be incompatible across versions of python3. e.g. the original change was 8 years ago, so it's worked up till today. I'm going to nack this from landing until we've verified that it works across py3.6 -> py3.9 (?py 3.10?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that does sound better, and it's similar to what create_logical_volume
does via lvcreate
. What do you think, @ajkavanagh ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on passing --yes
and replacing the use of Popen
with subprocess.check_call
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holding until it's been verified; the unit tests passing don't necessarily mean that it'll actually work in deployment. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmlg , do you have some CI job where this patch is being exercised?
@@ -60,7 +60,7 @@ def remove_lvm_physical_volume(block_device): | |||
''' | |||
p = Popen(['pvremove', '-ff', block_device], | |||
stdin=PIPE) | |||
p.communicate(input='y\n') | |||
p.communicate(input=b'y\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on passing --yes
and replacing the use of Popen
with subprocess.check_call
.
No, but I've been using it as part of running the functional tests locally for the cinder-lvm charm. |
The call is wrongly passing a string when only bytes-like are allowed.
This PR modified the call to no longer use 'Popen', but it was missing the corresponding fix in the unit test for said function.
ff66ab1
to
e44a15e
Compare
Rebased on top of master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Changes have been addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The call is wrongly passing a string when only bytes-like are allowed.