-
Notifications
You must be signed in to change notification settings - Fork 27
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
get_osd_id: silence errors #107
base: master
Are you sure you want to change the base?
Conversation
https://bugzilla.suse.com/show_bug.cgi?id=1073237#c4 & 5 When creating OSDs, it waits for for get_osd_id to return a value which caused ugly error messages in the logs: cat: /var/lib/ceph/osd/ceph-7/var/lib/ceph/tmp/mnt.lAtztf/whoami: No such file or directory
@@ -164,7 +164,7 @@ def have_quorum?() | |||
|
|||
def get_osd_id(device) | |||
osd_path = %x[mount | grep #{device} | awk '{print $3}'].tr("\n","") | |||
osd_id = %x[cat #{osd_path}/whoami].tr("\n","") | |||
osd_id = %x[cat #{osd_path}/whoami 2>/dev/null].tr("\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.
Style/CommandLiteral: Use backticks around command string. (https://github.com/bbatsov/ruby-style-guide#percent-x)
Style/PercentLiteralDelimiters: %x-literals should be delimited by ( and ). (https://github.com/bbatsov/ruby-style-guide#percent-literal-braces)
Layout/SpaceAfterComma: Space missing after comma. (https://github.com/bbatsov/ruby-style-guide#spaces-operators)
Shouldn't we add a check for that file presence? |
what would be the advantage? cat already checks for presence... |
Just thought it might be nicer and more readable, but probably is not really needed |
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.
It's definitely compact @bmwiedemann 😉. I still don't quite understand how stderr
ends up in the log file.
https://bugzilla.suse.com/show_bug.cgi?id=1073237#c4 & 5
When creating OSDs, it waits for for get_osd_id to return a value
which caused ugly error messages in the logs:
cat: /var/lib/ceph/osd/ceph-7/var/lib/ceph/tmp/mnt.lAtztf/whoami: No such file or directory