-
Notifications
You must be signed in to change notification settings - Fork 14
YUPANA-42 - transform bios UUID field to omit invalid value #350
YUPANA-42 - transform bios UUID field to omit invalid value #350
Conversation
kgaikwad
commented
Jun 14, 2021
•
edited
Loading
edited
- adding @ShimShtein into loop for review
0919c19
to
0cf69fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #350 +/- ##
==========================================
+ Coverage 94.07% 94.13% +0.06%
==========================================
Files 20 20
Lines 1434 1450 +16
Branches 166 168 +2
==========================================
+ Hits 1349 1365 +16
Misses 60 60
Partials 25 25
Continue to review full report at Codecov.
|
except ValueError: | ||
return False | ||
|
||
return str(uuid_obj) == uuid |
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.
I think this can filter out uppercase-lowercase differences in the string:
00000000-AAAA-AAAA-0000-000000000000
is valid, but not equal to 00000000-aaaa-aaaa-0000-000000000000
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.
Thanks @ShimShtein for review. Fixed it and added test case.
0cf69fa
to
7130191
Compare
ACK from me, not tested though |
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.
LGTM!
7130191
to
67e80c8
Compare
67e80c8
to
bae8fa4
Compare
Merged, thanks @kgaikwad !! |
"""Remove invalid bios UUID.""" | ||
uuid = host.get('bios_uuid') | ||
if not isinstance(uuid, str): | ||
return host |
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.
Hello @ShimShtein,
Here I am returning host object when value is not a string type.
For testing, QE tried passing values of type None/boolean/number to bios_uuid
field, it will return host as it is which results into host rejection from inventory service.
What do you think - do I need to handle above scenarios & omit this field?
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.
For completeness sake you are correct. I am quite sure that in production we won't have values that are not strings here, but we can never know.
I suppose we can be more specific and short circuit only if the field is not present at all, something like
if uuid is None
return host
Everything else should fall into the next if not self.is_valid_uuid:
statement
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.