Skip to content

Commit

Permalink
Merge pull request #556 from npawelek/fix_bonding_split
Browse files Browse the repository at this point in the history
Fix bonding slave_count logic
  • Loading branch information
tonytan4ever authored Sep 6, 2018
2 parents 2d158c0 + e5b35c7 commit 037cc33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions playbooks/files/rax-maas/plugins/bonding_iface_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions releasenotes/notes/fix_bonding_split-6810497056a209a0.yaml
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 037cc33

Please sign in to comment.