Skip to content

Commit d405f1a

Browse files
committed
fix also for 2.2.0 and 2.1.0
1 parent 4bd0a1a commit d405f1a

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

plugins/module_utils/discovery_210.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ def _service_completion_api(self):
139139

140140
def _wait_for_completion(self, what):
141141
now = time.time()
142-
deadline = now + self.timeout
142+
if self.timeout > 0:
143+
deadline = now + self.timeout
144+
else:
145+
deadline = 0 # In case of infinite timeout
146+
143147
while True:
144148
now = time.time()
145-
if now > deadline:
149+
if self.timeout > 0 and now > deadline:
146150
return generate_result(
147151
msg="Timeout reached while waiting for %s discovery" % what
148152
)

plugins/module_utils/discovery_220.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,14 @@ def _service_completion_api(self):
144144

145145
def _wait_for_completion(self, what):
146146
now = time.time()
147-
deadline = now + self.timeout
147+
if self.timeout > 0:
148+
deadline = now + self.timeout
149+
else:
150+
deadline = 0 # In case of infinite timeout
151+
148152
while True:
149153
now = time.time()
150-
if now > deadline:
154+
if self.timeout > 0 and now > deadline:
151155
return generate_result(
152156
msg="Timeout reached while waiting for %s discovery" % what
153157
)

plugins/modules/discovery.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@
7171
type: bool
7272
default: True
7373
wait_timeout:
74-
description: The time in seconds to wait for (previous/current) completion.
74+
description:
75+
- The time in seconds to wait for (previous/current) completion.
76+
- Default is -1, which means infinite.
7577
type: int
76-
default: -1 (infinite)
78+
default: -1
7779
7880
7981
author:

0 commit comments

Comments
 (0)