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

nautilus: ceph-volume: prints log messages to stdout #29600

Merged
merged 2 commits into from Aug 13, 2019

Conversation

@jan--f
Copy link
Member

commented Aug 12, 2019

tchaikov and others added 2 commits Mar 24, 2019
ceph-volume: terminal: encode unicode when writing to stdout
python determins the encoding of stdout and stderr based on the LC_CTYPE
and PYTHONIOENCODING env variable, by default, python3's sys.stdout uses
'utf-8' as its encoding, so it will be able to write unicode string even
the stdout is not attached to a tty device. but when it comes to
python2, it will default to ascii if neither of these variabls is set.
so, if we are writing unicode using `_Write` in an environment where
LC_CTYPE and/or PYTHONIOENCODING are using non UTF-8 encoding, it chokes
by raising `UnicodeEncodeError` exception.

in this change, we add a wrapper around `_Write._writer` so it is able
to write unicode string in such a non-unicode-friendly environment.

for more info related the encoding of stdout and stderr, see
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONIOENCODING .

Signed-off-by: Alfredo Deza <adeza@redhat.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 77912c0)
ceph-volume: never log to stdout, use stderr instead
We should never print log messages to stdout, as this should be reserved
for output of ceph-volume.

Fixes: https://tracker.ceph.com/issues/41158

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit b8d6dcb)

@jan--f jan--f self-assigned this Aug 12, 2019

@jan--f jan--f added this to the nautilus milestone Aug 12, 2019

@jan--f jan--f requested a review from alfredodeza Aug 12, 2019

@alfredodeza

This comment has been minimized.

Copy link
Contributor

commented Aug 12, 2019

jenkins test ceph-volume tox

@alfredodeza alfredodeza merged commit a274ec1 into ceph:nautilus Aug 13, 2019

4 of 5 checks passed

Docs: build check Docs: failed with errors
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
ceph-volume tox testing ceph-volume tox OK
Details
make check make check succeeded
Details

@jan--f jan--f deleted the jan--f:wip-41203-nautilus branch Aug 14, 2019

@smithfarm smithfarm changed the title nautilus: ceph-volume prints log messages to stdout nautilus: ceph-volume: prints log messages to stdout Aug 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.