#92 Fix https://pagure.io/testcloud/issue/89
Merged 3 years ago by frantisekz. Opened 3 years ago by lnie.
lnie/testcloud fix-an-issue  into  master

file modified
+7 -6
@@ -442,12 +442,13 @@ 

          if len(available_in_interval) > 0:

              i = 0

              recycleable_ports = [item for item in available_in_interval if item not in used_ports]

-             if len(recycleable_ports) > 0:

-                 next_port = recycleable_ports[0]

-                 while not self.check_port_available(recycleable_ports[i]):

-                     i = i + 1

-                     next_port = recycleable_ports[i]

-                 return next_port

+             length = len(recycleable_ports)

+             if length > 0:

+                 while i < length:

+                     if self.check_port_available(recycleable_ports[i]):

+                         return recycleable_ports[i]

+                     else:

+                         i = i + 1

  

          next_port = max(used_ports) + 1

          while not self.check_port_available(next_port):

so,here is the PR to fix #89:)

Just a reaaally tiny nitpick:

Can you change:

next_port = recycleable_ports[i]
return next_port

to

return recycleable_ports[i]

?

Apart from that, please rebase this and I'll do the merge thingie.

Thanks!

rebased onto d5dbd71d13f4d9439d8243c532a5d655bb613cf7

3 years ago

Ah,wait,forgot to rebase

rebased onto 2caa8c7b7c2acaf722a7e9144c54cf38ae1255ae

3 years ago

You probably wanted:

while i < length:

(without -1).

I might be missing something, but it seems wrong to skip the last entry of recycleable_ports?

rebased onto 927c5c8

3 years ago

Ah,yes,sorry,updated

Pull-Request has been merged by frantisekz

3 years ago
Metadata