Skip to content

Commit

Permalink
Minor fix to ensure that an empty ip_tags or reverse_ip_tags list rather
Browse files Browse the repository at this point in the history
than None does not break things
  • Loading branch information
rowleya committed Jun 22, 2015
1 parent a954505 commit fbe47c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pacman/utilities/resource_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def _are_ip_tags_available(self, chip, board_address, ip_tags):
:rtype: bool
"""
# If there are no tags to assign, declare that they are available
if ip_tags is None:
if ip_tags is None or len(ip_tags) == 0:
return True

# If there is a fixed board address and the chip is not on the board
Expand Down Expand Up @@ -426,7 +426,7 @@ def _are_reverse_ip_tags_available(self, chip, board_address,
:rtype: bool
"""
# If there are no tags, declare they are available
if reverse_ip_tags is None:
if reverse_ip_tags is None or len(reverse_ip_tags) == 0:
return True

# If there is a fixed board address and the chip is not on the board
Expand Down Expand Up @@ -530,7 +530,7 @@ def _allocate_ip_tags(self, board_address, ip_tags):
:return: iterable of tuples of (board address, tag) assigned
:rtype: iterable of (str, int)
"""
if ip_tags is None:
if ip_tags is None or len(ip_tags) == 0:
return None
allocations = list()
for ip_tag in ip_tags:
Expand Down Expand Up @@ -575,7 +575,7 @@ def _allocate_reverse_ip_tags(self, board_address, reverse_ip_tags):
:return: iterable of tuples of (board address, tag) assigned
:rtype: iterable of (str, int)
"""
if reverse_ip_tags is None:
if reverse_ip_tags is None or len(reverse_ip_tags) == 0:
return None
allocations = list()
for reverse_ip_tag in reverse_ip_tags:
Expand Down

0 comments on commit fbe47c2

Please sign in to comment.