Skip to content

Commit ac76d48

Browse files
a-dubsblackboxsw
authored andcommitted
fix(ibm): actually fix attaching of floating ips
A boolean was being checked against None incorrectly so the falsey value was not respected. This fixes that.
1 parent 27b71c2 commit ac76d48

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1!9.3.0
1+
1!9.3.1

pycloudlib/ibm/instance.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,15 +652,15 @@ def _attach_floating_ip_until_success(
652652
Raises:
653653
IBMException: If failed to attach floating IP after 10 tries
654654
"""
655-
attached_floating_ip = None
655+
floating_ip_is_attached = None
656656
self._log.info(
657657
"Will attempt to attach floating ip with name containing: %s"
658658
"until successful or all floating ips are in use.",
659659
floating_ip_substring,
660660
)
661661

662662
tries = 0
663-
while attached_floating_ip is None:
663+
while not floating_ip_is_attached:
664664
tries += 1
665665
target_floating_ip = self._choose_from_existing_floating_ips(
666666
name_includes=floating_ip_substring,
@@ -669,8 +669,10 @@ def _attach_floating_ip_until_success(
669669
"Attempting to attach floating ip: %s",
670670
target_floating_ip["name"],
671671
)
672-
attached_floating_ip = self._attach_floating_ip(target_floating_ip)
673-
if not attached_floating_ip:
672+
floating_ip_is_attached = self._attach_floating_ip(
673+
floating_ip=target_floating_ip
674+
)
675+
if not floating_ip_is_attached:
674676
self._log.info(
675677
"Failed to attach floating ip: %s. Will try again.",
676678
target_floating_ip["name"],

0 commit comments

Comments
 (0)