Skip to content

Conversation

@beckerg
Copy link
Contributor

@beckerg beckerg commented Jul 15, 2022

Signed-off-by: Greg Becker [email protected]

@beckerg beckerg requested a review from tristan957 July 15, 2022 19:17
@beckerg
Copy link
Contributor Author

beckerg commented Jul 15, 2022

This hack should get SQA back on track, maybe some Python experts can help me out :-)

@beckerg beckerg requested a review from twblamer July 15, 2022 19:19
try:
from typing import OrderedDict
except ImportError:
from typing import Dict as OrderedDict
Copy link
Member

Choose a reason for hiding this comment

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

Does the dict have to be ordered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only to preserve column order...

# TODO: How to test if ybuf[] contain at least one "nodes" stanza?
#
try:
for node in ybuf["nodes"]:
Copy link
Member

Choose a reason for hiding this comment

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

if "nodes" in ybuf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, that only works if "nodes" is in ybuf...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ybuf is some kind of monstrosity i don't grok, it returns NoneType if "nodes" is not in ybuf, but you shouldn't test explicitly for None/NoneType, not to mention the none stuff seems to vary depending on Python version, uhg...

Copy link
Member

Choose a reason for hiding this comment

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

"nodes" in ybuf

tells you that there is a key called "nodes". If you are looking to make sure there is a node in the array, then do this:

if ybuf.get("nodes", []): return

Copy link
Contributor Author

@beckerg beckerg Jul 15, 2022

Choose a reason for hiding this comment

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

That doesn't work, it always returns true.

Cuz.. I'm an idiot, thanks Tristan!

Signed-off-by: Greg Becker <[email protected]>
@beckerg beckerg merged commit 513db23 into master Jul 15, 2022
@beckerg beckerg deleted the greg/NFSE-5245-cn-metrics-failing branch July 15, 2022 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants