Merge "Prevent failure on get quiesce_wait_time"

This commit is contained in:
Zuul 2023-02-18 16:35:33 +00:00 committed by Gerrit Code Review
commit 214dc4fb73

View File

@ -278,7 +278,11 @@ class ShareReplicationController(wsgi.Controller, wsgi.AdminActionsMixin):
quiesce_wait_time = None quiesce_wait_time = None
if allow_quiesce_wait_time: if allow_quiesce_wait_time:
wait_time = body.get('promote', {}).get('quiesce_wait_time') # NOTE(carloss): there is a chance that we receive
# {'promote': null}, so we need to prevent that
promote_data = body.get('promote', {})
promote_data = {} if promote_data is None else promote_data
wait_time = promote_data.get('quiesce_wait_time')
if wait_time: if wait_time:
if not strutils.is_int_like(wait_time) or int(wait_time) <= 0: if not strutils.is_int_like(wait_time) or int(wait_time) <= 0:
msg = _("quiesce_wait_time must be an integer and " msg = _("quiesce_wait_time must be an integer and "