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

get_osd_id: silence errors #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

bmwiedemann
Copy link
Member

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

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","")

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)

@jsuchome
Copy link
Member

jsuchome commented Feb 7, 2018

Shouldn't we add a check for that file presence?

@bmwiedemann
Copy link
Member Author

what would be the advantage? cat already checks for presence...
or do you mean a separate checking function?

@jsuchome
Copy link
Member

jsuchome commented Feb 7, 2018

Just thought it might be nicer and more readable, but probably is not really needed

Copy link
Contributor

@nicolasbock nicolasbock left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants