Navigation Menu

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

ceph.in: allow 'flags' to not be present in cmddescs #12540

Merged
merged 1 commit into from Dec 20, 2016

Conversation

dmick
Copy link
Member

@dmick dmick commented Dec 16, 2016

the 'flags' key in the command description dict may not be
present on older monitors. Check for existence before
using it.

Introduced in 61d6343

Fixes: http://tracker.ceph.com/issues/18297
Signed-off-by: Dan Mick dan.mick@redhat.com

the 'flags' key in the command description dict may not be
present on older monitors.  Check for existence before
using it.

Introduced in 61d6343

Fixes: http://tracker.ceph.com/issues/18297
Signed-off-by: Dan Mick <dan.mick@redhat.com>
@dmick dmick assigned dmick, zmc and batrick and unassigned dmick Dec 16, 2016
@dmick dmick requested review from zmc and batrick December 16, 2016 23:18
@dmick dmick unassigned zmc Dec 16, 2016
@liewegas liewegas added this to the kraken milestone Dec 17, 2016
Copy link
Contributor

@alfredodeza alfredodeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to fix the problem, but the current implementation (not the fix itself) is really hard to parse and uses unnecessary bitwise operators. It would be great to see those go away and have a simpler approach here

@@ -342,7 +342,9 @@ def format_help(cmddict, partial=None):

if not cmd['help']:
continue
if cmd['flags'] is not None and ((cmd['flags'] & (FLAG_OBSOLETE | FLAG_DEPRECATED)) != 0):
flags = cmd.get('flags')
if (flags is not None and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this explicit check for flags is not None is clearly fixing the issue, but this is extremely hard to parse due to the uncommon usage of Python's bitwise operators.

Is it really that necessary to use logical bitwise operators to check if a flag is obsolete or deprecated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it can be changed without chagning hte json schema...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it is not necessary to use &, |, or << here. Regular Python operators would do just fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just saw this. It seems like idiomatic usage to me, but then I'm a C programmer first

@liewegas liewegas merged commit e0903c9 into ceph:master Dec 20, 2016
@dmick dmick deleted the wip-18297 branch December 20, 2016 21:40
@batrick
Copy link
Member

batrick commented Jan 9, 2017

I was on PTO when you requested this review. It looks good. Thanks for fixing this @dmick.

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