Skip to content

Commit

Permalink
[rqd] Raise exception during startup if CUEBOT_HOSTNAME is empty. (#1237
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bcipriano authored Jan 21, 2023
1 parent 0466051 commit 6339087
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rqd/rqd/rqnetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import rqd.compiled_proto.report_pb2_grpc
import rqd.compiled_proto.rqd_pb2_grpc
import rqd.rqconstants
import rqd.rqexceptions
import rqd.rqdservicers
import rqd.rqutil

Expand Down Expand Up @@ -278,12 +279,13 @@ def __getChannel(self):
),
)

cuebots = rqd.rqconstants.CUEBOT_HOSTNAME.split()
cuebots = rqd.rqconstants.CUEBOT_HOSTNAME.strip().split()
if len(cuebots) == 0:
raise rqd.rqexceptions.RqdException("CUEBOT_HOSTNAME is empty")
shuffle(cuebots)
if len(cuebots) > 0:
self.channel = grpc.insecure_channel('%s:%s' % (cuebots[0],
rqd.rqconstants.CUEBOT_GRPC_PORT))
self.channel = grpc.intercept_channel(self.channel, *interceptors)
self.channel = grpc.insecure_channel('%s:%s' % (cuebots[0],
rqd.rqconstants.CUEBOT_GRPC_PORT))
self.channel = grpc.intercept_channel(self.channel, *interceptors)
atexit.register(self.closeChannel)

def __getReportStub(self):
Expand Down

0 comments on commit 6339087

Please sign in to comment.