bdm: Make sure that delete_on_termination is a boolean
Make sure that 'delete_on_termination' is always a boolean, even if it was not passed in and thus got defaulted to None up until now. This patch is really more of a pedantic fix, as we use objects for BDMs everywhere outside of the API service, and object fields are of the correct type. Related-bug: #1370177 Change-Id: I2724bcbe159490f3bdd85f833412f3b20c4e1e23
This commit is contained in:
@@ -86,6 +86,8 @@ class BlockDeviceDict(dict):
|
||||
self._validate(bdm_dict)
|
||||
if bdm_dict.get('device_name'):
|
||||
bdm_dict['device_name'] = prepend_dev(bdm_dict['device_name'])
|
||||
bdm_dict['delete_on_termination'] = bool(
|
||||
bdm_dict.get('delete_on_termination'))
|
||||
# NOTE (ndipanov): Never default db fields
|
||||
self.update({field: None for field in self._fields - do_not_default})
|
||||
self.update(list(six.iteritems(bdm_dict)))
|
||||
|
||||
Reference in New Issue
Block a user