yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #15481
[Bug 1328387] Re: Instance object String field coercion of bool value is surprising
Patch is -2'ed.
It's unfortunate but looks like we will have to live with this behavior.
** Changed in: nova
Status: In Progress => Won't Fix
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1328387
Title:
Instance object String field coercion of bool value is surprising
Status in OpenStack Compute (Nova):
Won't Fix
Bug description:
So in the process of converting certain test case from using an
instance dict to a fake instance object, I noticed the following:
self.instance_object.config_drive = False
self.assertFalse(self.instance_object.config_drive) # <<<< Fails
The reason the config_drive attribute is exhibiting this behavior is because it is actually declared as a String in the schema
(see related bug: https://bugs.launchpad.net/nova/+bug/1193438), and assignment of a bool value to it results in coercion to u'False' which evaluates to True in the boolean context.
While this issue can easily be worked around in the config drive unit
test (or with some conversion in the configdrive module where the
attribute is used), it would be less surprising in general for a bool
False value to be coerced to a string that once again evaluates to
False.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1328387/+subscriptions
References