summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMartin Nečas <necas.marty@gmail.com>2019-02-04 15:52:37 +0100
committerJohn R Barker <john@johnrbarker.com>2019-02-04 14:52:37 +0000
commite0de42fe488fcf91edd22c8503ee3fe9a69b868c (patch)
treeddacd34493df39c00b7d51715b3dfa1dd661787b /lib
parent70497df8d62bcaa73de8c530ed9c12f92d2e8cfd (diff)
downloadansible-e0de42fe488fcf91edd22c8503ee3fe9a69b868c.tar.gz
Ovirt vm state running wait false (#51024)
* ovirt change wait when state running * add seting vm wait before creating module * update wait for running vm * ovirt vm sanity pylint correction * ovirt add wait create * update pep8 snytax * update pep8 snytax 2
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/module_utils/ovirt.py3
-rw-r--r--lib/ansible/modules/cloud/ovirt/ovirt_vm.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/ansible/module_utils/ovirt.py b/lib/ansible/module_utils/ovirt.py
index fface39708..2114e93d60 100644
--- a/lib/ansible/module_utils/ovirt.py
+++ b/lib/ansible/module_utils/ovirt.py
@@ -541,6 +541,7 @@ class BaseModule(object):
fail_condition=lambda e: False,
search_params=None,
update_params=None,
+ _wait=None,
**kwargs
):
"""
@@ -621,7 +622,7 @@ class BaseModule(object):
service=entity_service,
condition=state_condition,
fail_condition=fail_condition,
- wait=self._module.params['wait'],
+ wait=_wait if _wait is not None else self._module.params['wait'],
timeout=self._module.params['timeout'],
poll_interval=self._module.params['poll_interval'],
)
diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py
index fe722233cb..f0ecc91752 100644
--- a/lib/ansible/modules/cloud/ovirt/ovirt_vm.py
+++ b/lib/ansible/modules/cloud/ovirt/ovirt_vm.py
@@ -2087,6 +2087,7 @@ def main():
if module.params['xen'] or module.params['kvm'] or module.params['vmware']:
vms_module.changed = import_vm(module, connection)
+ # In case of wait=false and state=running, waits for VM to be created
# In case VM don't exist, wait for VM DOWN state,
# otherwise don't wait for any state, just update VM:
ret = vms_module.create(
@@ -2095,6 +2096,7 @@ def main():
update_params={'next_run': module.params['next_run']} if module.params['next_run'] is not None else None,
clone=module.params['clone'],
clone_permissions=module.params['clone_permissions'],
+ _wait=True if not module.params['wait'] and state == 'running' else module.params['wait'],
)
# If VM is going to be created and check_mode is on, return now:
if module.check_mode and ret.get('id') is None: