diff --git a/playbooks/files/rax-maas/plugins/bonding_iface_check.py b/playbooks/files/rax-maas/plugins/bonding_iface_check.py index c0a44510d..f712de466 100644 --- a/playbooks/files/rax-maas/plugins/bonding_iface_check.py +++ b/playbooks/files/rax-maas/plugins/bonding_iface_check.py @@ -34,17 +34,19 @@ def bonding_ifaces_check(_): bonding_iface_check_cmd_output_lines = ( bonding_iface_check_cmd_output.split('\n') ) - - has_slave_down = False slave_count = 0 for idx, line in enumerate(bonding_iface_check_cmd_output_lines): if line.startswith("Slave Interface"): slave_count = slave_count + 1 + + has_slave_down = False + for idx, line in enumerate(bonding_iface_check_cmd_output_lines): + if line.startswith("Slave Interface"): slave_inface_mii_status_line = ( bonding_iface_check_cmd_output_lines[idx + 1] ) slave_inface_mii_status = ( - slave_inface_mii_status_line.split(":")[1] + slave_inface_mii_status_line.split(":")[1].strip() ) if 'up' not in slave_inface_mii_status or slave_count < 2: has_slave_down = True diff --git a/releasenotes/notes/fix_bonding_split-6810497056a209a0.yaml b/releasenotes/notes/fix_bonding_split-6810497056a209a0.yaml new file mode 100644 index 000000000..6f88a1fab --- /dev/null +++ b/releasenotes/notes/fix_bonding_split-6810497056a209a0.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fix the bonding mii split logic to remove leading and trailing spaces and + calculate the slave_count outside the loop determining if a slave is down.