-
Notifications
You must be signed in to change notification settings - Fork 6k
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 stderr failure to decode/encode when redirected #30274
Conversation
Signed-off-by: Alfredo Deza <adeza@redhat.com>
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.
Code-wise this looks good to me. I'm wondering though, this patch falls back to using the terminal logger if _writer.write
throws something. Why not use the terminal logger right away?
This PR should not be definite, and there should be new work put into place to fully remove the custom terminal logging so that the
logging
module is used instead. Since it is critical to have this fixed right away, my intention is to move this forward all the way to luminous and then start thinking about a proper solution to the terminal logging problem.
Agreed. Having terminal.write
use the terminal logger should get us there most of the way though, shouldn't it? Not pretty, but the unnecessary code can be stripped out at a later stage.
@@ -80,34 +82,13 @@ def make(cls, string): | |||
class _Write(object): | |||
|
|||
def __init__(self, _writer=None, prefix='', suffix='', flush=False): | |||
# we can't set sys.stderr as the default for _writer. Otherwise | |||
# we can't set sys.stderr as the default for _writer. otherwise |
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.
# we can't set sys.stderr as the default for _writer. otherwise | |
# we can't set sys.stderr as the default for _writer, otherwise |
There are more things involved if we want to use the logger. Internally, ceph-volume makes a distinction about stderr and stdout from commandline tools, those have color outputs, and no indication of log levels etc... It would take a bit more effort to get there, I think. Also, when the work started, I thought it was going to be easier/simpler but it ended up requiring some sort of fallback which happened towards the end. My preference would be to focus in the fix (with the fallback) and try to get a better solution with logging in a separate PR. I am happy to address any potential problems you see here though. Let's try to make sure this works really well |
Signed-off-by: Alfredo Deza <adeza@redhat.com>
Signed-off-by: Alfredo Deza <adeza@redhat.com>
This caused problems in environments where stderr was redirected, since stderr sets the encoding to None. Getting it back again allows everything to work correctly, and keeps all the current unit tests passing Signed-off-by: Alfredo Deza <adeza@redhat.com>
Signed-off-by: Alfredo Deza <adeza@redhat.com>
Signed-off-by: Alfredo Deza <adeza@redhat.com>
Signed-off-by: Alfredo Deza <adeza@redhat.com>
Alright, should have guessed that things are more complicated then that ;)
Sounds good to me. Feel free to get in touch to discuss solutions. |
@andrewschoen @tchaikov if you could also take a look please... this is a big fix and want to make sure I am getting it 100% right |
jenkins test ceph-volume tox |
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 think this looks good. I'm thinking we should hook in the new functional testing into the CI eventually. If this is really urgent maybe we should not block on that though.
This has taken a tremendous amount of work, and it is rolling back most/all of the automatic encoding/decoding effort done in 77912c0c718
In addition to the removal, I am making sure that
logging
moduleThis PR should not be definite, and there should be new work put into place to fully remove the custom terminal logging so that the
logging
module is used instead. Since it is critical to have this fixed right away, my intention is to move this forward all the way to luminous and then start thinking about a proper solution to the terminal logging problem.Fixes: https://tracker.ceph.com/issues/41660