Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Bug 825460 - relay.py should not throw on socket exceptions, return F…
Browse files Browse the repository at this point in the history
…alse instead. r=jmaher
  • Loading branch information
Callek committed Dec 31, 2012
1 parent 4aa00f7 commit 44ed213
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sut_tools/relay.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -106,13 +106,16 @@ def powercycle(relay_hostname, bank, relay):
""" """
assert(bank >= 1 and bank <= 4) assert(bank >= 1 and bank <= 4)
assert(relay >= 1 and relay <= 8) assert(relay >= 1 and relay <= 8)
with connected_socket(relay_hostname, PORT) as sock: try:
# Turn relay on to power off device with connected_socket(relay_hostname, PORT) as sock:
if not set_status(sock, bank, relay, True): # Turn relay on to power off device
return False if not set_status(sock, bank, relay, True):
# Turn relay off to power on device return False
if set_status(sock, bank, relay, False): # Turn relay off to power on device
return False if set_status(sock, bank, relay, False):
return False
except:
return False
return True return True




Expand Down

0 comments on commit 44ed213

Please sign in to comment.