Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 825460 - relay.py should not throw on socket exceptions, return F…

…alse instead. r=jmaher
  • Loading branch information...
commit 44ed2132666936e270c323c3189c830a2940e0ac 1 parent 4aa00f7
@Callek Callek authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 sut_tools/relay.py
View
17 sut_tools/relay.py
@@ -106,13 +106,16 @@ def powercycle(relay_hostname, bank, relay):
"""
assert(bank >= 1 and bank <= 4)
assert(relay >= 1 and relay <= 8)
- with connected_socket(relay_hostname, PORT) as sock:
- # Turn relay on to power off device
- if not set_status(sock, bank, relay, True):
- return False
- # Turn relay off to power on device
- if set_status(sock, bank, relay, False):
- return False
+ try:
+ with connected_socket(relay_hostname, PORT) as sock:
+ # Turn relay on to power off device
+ if not set_status(sock, bank, relay, True):
+ return False
+ # Turn relay off to power on device
+ if set_status(sock, bank, relay, False):
+ return False
+ except:
+ return False
return True
Please sign in to comment.
Something went wrong with that request. Please try again.