mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
ovirt_templates: wait for OK state when importing (#31634)
This commit is contained in:
committed by
Ryan Brown
parent
1c0dd5406b
commit
ee26ecfcfd
@@ -746,14 +746,14 @@ class BaseModule(object):
|
||||
'diff': self._diff,
|
||||
}
|
||||
|
||||
def wait_for_import(self):
|
||||
def wait_for_import(self, condition=lambda e: True):
|
||||
if self._module.params['wait']:
|
||||
start = time.time()
|
||||
timeout = self._module.params['timeout']
|
||||
poll_interval = self._module.params['poll_interval']
|
||||
while time.time() < start + timeout:
|
||||
entity = self.search_entity()
|
||||
if entity:
|
||||
if entity and condition(entity):
|
||||
return entity
|
||||
time.sleep(poll_interval)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user