Fix for timeout=None in orchestration API calls

Our other API calls allow timeout=None to mean "no timeout". Heat does
not have an equivalent for "no timeout", but None will mean to use the
heat server default. Allow for this value in the orchestration calls.

Change-Id: Iae775676e9bb7d3f58d7041537f3a3b15ba52593
This commit is contained in:
David Shrewsbury 2018-02-23 08:55:56 -05:00
parent 8d1902b33d
commit 9be6d3ac16
2 changed files with 16 additions and 4 deletions

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Allow None for timeout in create_stack() and update_stack() calls.

View File

@ -1285,7 +1285,8 @@ class OpenStackCloud(
:param dict files: dict of additional file content to include.
:param boolean rollback: Enable rollback on create failure.
:param boolean wait: Whether to wait for the delete to finish.
:param int timeout: Stack create timeout in seconds.
:param int timeout: Stack create timeout in seconds. None will use
the server default.
:param list environment_files: Paths to environment files to apply.
Other arguments will be passed as stack parameters which will take
@ -1299,6 +1300,9 @@ class OpenStackCloud(
:raises: ``OpenStackCloudException`` if something goes wrong during
the OpenStack API call
"""
if timeout:
timeout = timeout // 60
envfiles, env = template_utils.process_multiple_environments_and_files(
env_paths=environment_files)
tpl_files, template = template_utils.get_template_contents(
@ -1314,7 +1318,7 @@ class OpenStackCloud(
template=template,
files=dict(list(tpl_files.items()) + list(envfiles.items())),
environment=env,
timeout_mins=timeout // 60,
timeout_mins=timeout,
)
self._orchestration_client.post('/stacks', json=params)
if wait:
@ -1339,7 +1343,8 @@ class OpenStackCloud(
:param dict files: dict of additional file content to include.
:param boolean rollback: Enable rollback on update failure.
:param boolean wait: Whether to wait for the delete to finish.
:param int timeout: Stack update timeout in seconds.
:param int timeout: Stack update timeout in seconds. None will use
the server default.
:param list environment_files: Paths to environment files to apply.
Other arguments will be passed as stack parameters which will take
@ -1353,6 +1358,9 @@ class OpenStackCloud(
:raises: ``OpenStackCloudException`` if something goes wrong during
the OpenStack API calls
"""
if timeout:
timeout = timeout // 60
envfiles, env = template_utils.process_multiple_environments_and_files(
env_paths=environment_files)
tpl_files, template = template_utils.get_template_contents(
@ -1366,7 +1374,7 @@ class OpenStackCloud(
template=template,
files=dict(list(tpl_files.items()) + list(envfiles.items())),
environment=env,
timeout_mins=timeout // 60,
timeout_mins=timeout,
)
if wait:
# find the last event to use as the marker