-
Couldn't load subscription status.
- Fork 293
CP-45977: Update scripts/extensions from python2 to python3 #5254
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
CP-45977: Update scripts/extensions from python2 to python3 #5254
Conversation
scripts/extensions/pool_update.apply
Outdated
| cmd = ['yum', 'clean', 'all', '--noplugins', '-c', yum_conf_file] | ||
| p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True, env=yum_env) | ||
| output, _ = p.communicate() | ||
| output = output.decode('utf-8') |
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.
would it be better to call Popen with encoding='utf-8' so stdout is opened in text mode?
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, you're right. Corrected!
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.
universal_newlines is often used to get the string output.
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.
Corrected and tested!
bc12946 to
ec6e5c1
Compare
|
Minor comment: |
ec6e5c1 to
9f24276
Compare
Done! |
| if os.path.isfile(update_precheck_file): | ||
| pp = subprocess.Popen(update_precheck_file, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) | ||
| precheck_output, _ = pp.communicate() | ||
| precheck_output = precheck_output.decode("utf-8") |
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.
This one is missed for universal_newlines=True ?
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.
Corrected!
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.
Approved with minor comments, Please check.
Signed-off-by: Stephen Cheng <stephen.cheng@cloud.com>
9f24276 to
6693647
Compare
Uh oh!
There was an error while loading. Please reload this page.