Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence hardware issues from Sentry #84

Merged
merged 3 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pktfwd/pktfwd_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def start(self):
# retry_start_concentrator will hang indefinitely while the
# upstream packet_forwarder runs. The lines below will only
# be reached if the concentrator exits unexpectedly.
LOGGER.error("Unable to start concentrator. Shutting down.")
LOGGER.warning("Shutting down concentrator.")
self.stop()

def prepare_to_start(self):
Expand Down
13 changes: 8 additions & 5 deletions pktfwd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ def is_concentrator_sx1302(util_chip_id_filepath, spi_bus):
try:
subprocess.run(util_chip_id_cmd, capture_output=True,
text=True, check=True)
LOGGER.debug("SX1302 / SX1303 detected. util_chip_id script exited without error.")
LOGGER.debug("SX1302 / SX1303 detected. \
util_chip_id script exited without error.")
return True
# CalledProcessError raised if there is a non-zero exit code
# https://docs.python.org/3/library/subprocess.html#using-the-subprocess-module
except subprocess.CalledProcessError as e:
LOGGER.debug(e)
except Exception:
LOGGER.exception("SX1301 detected. util_chip_id script exited with error.")
LOGGER.exception("SX1301 detected.\
util_chip_id script exited with error.")

return False

Expand Down Expand Up @@ -215,10 +217,11 @@ def retry_start_concentrator(is_sx1302, spi_bus,
# by throwing an exception, which will trigger retry.
elif lora_pkt_fwd_proc_returncode == 0:
raise LoraPacketForwarderStoppedWithoutError(
"lora_pkt_fwd stopped without error.")
"lora_pkt_fwd stopped\
without error.")

# lora_pkt_fwd exited with error. Restart the container by letting
# the python application exit without error.
else:
LOGGER.error("lora_pkt_fwd stopped with code=%s." %
lora_pkt_fwd_proc_returncode)
LOGGER.warning("lora_pkt_fwd stopped with code=%s." %
lora_pkt_fwd_proc_returncode)