From fb430df6fb16723d604ef274c42e1ff8d4dec2d8 Mon Sep 17 00:00:00 2001 From: Eric Harney Date: Tue, 9 Nov 2021 10:19:03 -0500 Subject: [PATCH] Clarify conditional_update return types Comments currently state that conditional_update() returns an int, but it actually returns a boolean. Change-Id: I5d2349db2a884c7bea63c2f23da5b666a0d9029c --- cinder/db/api.py | 2 +- cinder/objects/base.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cinder/db/api.py b/cinder/db/api.py index e6f0e572ab1..e4130bd098e 100644 --- a/cinder/db/api.py +++ b/cinder/db/api.py @@ -1935,7 +1935,7 @@ def conditional_update(context, model, values, expected_values, filters=(), equivalent to read_deleted. :param project_only: Should the query be limited to context's project. :param order: Specific order of fields in which to update the values - :returns: Number of db rows that were updated. + :returns: Boolean indicating whether db rows were updated. """ return IMPL.conditional_update(context, model, values, expected_values, filters, include_deleted, project_only, diff --git a/cinder/objects/base.py b/cinder/objects/base.py index 116906eabb8..613912ec1ed 100644 --- a/cinder/objects/base.py +++ b/cinder/objects/base.py @@ -412,9 +412,9 @@ class CinderPersistentObject(object): mean in some cases that we have to reload the object from the database. :param order: Specific order of fields in which to update the values - :returns: number of db rows that were updated, which can be used as a - boolean, since it will be 0 if we couldn't update the DB and - 1 if we could, because we are using unique index id. + :returns: Boolean indicating whether db rows were updated. + It will be False if we couldn't update the DB and + True if we could. """ if 'id' not in self.fields: msg = (_('VersionedObject %s does not support conditional update.')