Lease creation should fail if affinity is passed with invalid input
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Blazar |
Fix Released
|
Medium
|
Asmita Singh |
Bug Description
Description
===========
Lease for resource_type virtual:instance should not be created with invalid string values(
Steps to reproduce
==================
Create lease for instance reservation with affinity="abc".
Command:
blazar lease-create --reservation resource_
Expected result
===============
Lease create for instance reservation should fail with 400 BadRequest.
Actual Result
=============
Lease create for instance reservation with affinity="abc" is created successfully and the value of affinity is stored as null in DB.
Changed in blazar: | |
assignee: | nobody → Asmita Singh (asmita2018) |
status: | New → In Progress |
Changed in blazar: | |
importance: | Undecided → Medium |
Thank you for reporting this.
It is *now* supposed to be exactly what oslo.strutils. bool_from_ string( ) supports [1]. It can be a boolean, a string or an integer. Namely, boolean type value will be returned directly, otherwise the subject will be converted to a string. And case-insensitive match is performed.
TRUE_STRINGS = ('1', 't', 'true', 'on', 'y', 'yes')
FALSE_STRINGS = ('0', 'f', 'false', 'off', 'n', 'no')
NONE_STRINGS = [anything else]
According to this bug report, I assume we are going to restrict the value to boolean or string of either 'False' /'True' /'None' including their lower and capital cases.
[1] https:/ /github. com/openstack/ oslo.utils/ blob/master/ oslo_utils/ strutils. py#L115