Skip to content

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
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