Merge "Explicitly compare IDs to None"
This commit is contained in:
commit
320c820ed8
|
@ -622,8 +622,8 @@ class Resource(status.ResourceStatus):
|
|||
|
||||
def __str__(self):
|
||||
class_name = reflection.get_class_name(self, fully_qualified=False)
|
||||
if self.stack.id:
|
||||
if self.resource_id:
|
||||
if self.stack.id is not None:
|
||||
if self.resource_id is not None:
|
||||
text = '%s "%s" [%s] %s' % (class_name, self.name,
|
||||
self.resource_id,
|
||||
six.text_type(self.stack))
|
||||
|
@ -2335,7 +2335,7 @@ class Resource(status.ResourceStatus):
|
|||
|
||||
:returns: a dict representing the resource data for this resource.
|
||||
"""
|
||||
if self._data is None and self.id:
|
||||
if self._data is None and self.id is not None:
|
||||
try:
|
||||
self._data = resource_data_objects.ResourceData.get_all(self)
|
||||
except exception.NotFound:
|
||||
|
|
|
@ -353,7 +353,7 @@ class Stack(collections.Mapping):
|
|||
return resources or None
|
||||
|
||||
def db_resource_get(self, name):
|
||||
if not self.id:
|
||||
if self.id is None:
|
||||
return None
|
||||
return self._db_resources_get().get(name)
|
||||
|
||||
|
@ -454,7 +454,7 @@ class Stack(collections.Mapping):
|
|||
Includes nested stacks below.
|
||||
"""
|
||||
if not stack_id:
|
||||
if not self.id:
|
||||
if self.id is None:
|
||||
# We're not stored yet, so we don't have anything to count
|
||||
return 0
|
||||
stack_id = self.id
|
||||
|
@ -642,7 +642,7 @@ class Stack(collections.Mapping):
|
|||
else:
|
||||
s['raw_template_id'] = self.t.id
|
||||
|
||||
if self.id:
|
||||
if self.id is not None:
|
||||
if exp_trvsl is None and not ignore_traversal_check:
|
||||
exp_trvsl = self.current_traversal
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ class WatchRule(object):
|
|||
'stack_id': self.stack_id
|
||||
}
|
||||
|
||||
if not self.id:
|
||||
if self.id is None:
|
||||
wr = watch_rule_objects.WatchRule.create(self.context, wr_values)
|
||||
self.id = wr.id
|
||||
else:
|
||||
|
@ -120,7 +120,7 @@ class WatchRule(object):
|
|||
|
||||
def destroy(self):
|
||||
"""Delete the watchrule from the database."""
|
||||
if self.id:
|
||||
if self.id is not None:
|
||||
watch_rule_objects.WatchRule.delete(self.context, self.id)
|
||||
|
||||
def do_data_cmp(self, data, threshold):
|
||||
|
|
Loading…
Reference in New Issue