From 9be6d3ac160dc8b93a8d6a92cda85e0be8b0bcee Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Fri, 23 Feb 2018 08:55:56 -0500 Subject: [PATCH] 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 --- .../notes/orch_timeout-a3953376a9a96343.yaml | 4 ++++ shade/openstackcloud.py | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/orch_timeout-a3953376a9a96343.yaml diff --git a/releasenotes/notes/orch_timeout-a3953376a9a96343.yaml b/releasenotes/notes/orch_timeout-a3953376a9a96343.yaml new file mode 100644 index 000000000..bbb001974 --- /dev/null +++ b/releasenotes/notes/orch_timeout-a3953376a9a96343.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Allow None for timeout in create_stack() and update_stack() calls. diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py index 6a132f751..a9e0ff23e 100644 --- a/shade/openstackcloud.py +++ b/shade/openstackcloud.py @@ -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