Skip to content

Commit 63361e0

Browse files
hide this error for users on first boo
1 parent 4cf86c1 commit 63361e0

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

core/pioreactor/background_jobs/monitor.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import click
1111
from pioreactor import error_codes
12+
from pioreactor import exc
1213
from pioreactor import types as pt
1314
from pioreactor import utils
1415
from pioreactor import version
@@ -337,7 +338,13 @@ def check_heater_pcb_temperature(self) -> None:
337338
Originally from #220
338339
"""
339340
# if no model assigned or missing hardware, skip
340-
if get_pioreactor_model() is None:
341+
model = None
342+
try:
343+
model = get_pioreactor_model()
344+
except (exc.NoModelAssignedError, exc.UnknownModelAssignedError):
345+
return
346+
347+
if model is None:
341348
return
342349
elif not is_HAT_present() or not is_heating_pcb_present():
343350
return

core/pioreactor/web/api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,9 @@ def set_active_estimator(pioreactor_unit, device, estimator_name) -> DelayedResp
18011801
if pioreactor_unit == UNIVERSAL_IDENTIFIER:
18021802
task = broadcast_patch_across_workers(f"/unit_api/active_estimators/{device}/{estimator_name}")
18031803
else:
1804-
task = tasks.multicast_patch(f"/unit_api/active_estimators/{device}/{estimator_name}", [pioreactor_unit])
1804+
task = tasks.multicast_patch(
1805+
f"/unit_api/active_estimators/{device}/{estimator_name}", [pioreactor_unit]
1806+
)
18051807
return create_task_response(task)
18061808

18071809

@@ -1857,7 +1859,7 @@ def get_plugins_on_machine(pioreactor_unit: str) -> DelayedResponseReturnValue:
18571859
@api_bp.route("/units/<pioreactor_unit>/plugins/install", methods=["POST", "PATCH"])
18581860
def install_plugin_across_cluster(pioreactor_unit: str) -> DelayedResponseReturnValue:
18591861
# there is a security problem here. See https://github.com/Pioreactor/pioreactor/issues/421
1860-
if os.path.isfile(Path(os.environ["DOT_PIOREACTOR"]) / "DISALLOW_UI_INSTALLS"):
1862+
if (Path(os.environ["DOT_PIOREACTOR"]) / "DISALLOW_UI_INSTALLS").is_file():
18611863
abort_with(403, "Not UI installed allowed.")
18621864

18631865
if pioreactor_unit == UNIVERSAL_IDENTIFIER:
@@ -1872,7 +1874,7 @@ def install_plugin_across_cluster(pioreactor_unit: str) -> DelayedResponseReturn
18721874

18731875
@api_bp.route("/units/<pioreactor_unit>/plugins/uninstall", methods=["POST", "PATCH"])
18741876
def uninstall_plugin_across_cluster(pioreactor_unit: str) -> DelayedResponseReturnValue:
1875-
if os.path.isfile(Path(os.environ["DOT_PIOREACTOR"]) / "DISALLOW_UI_INSTALLS"):
1877+
if (Path(os.environ["DOT_PIOREACTOR"]) / "DISALLOW_UI_INSTALLS").is_file():
18761878
abort_with(403, "No UI uninstall allowed")
18771879

18781880
if pioreactor_unit == UNIVERSAL_IDENTIFIER:
@@ -1954,7 +1956,7 @@ def get_app_versions(pioreactor_unit: str) -> DelayedResponseReturnValue:
19541956

19551957
@api_bp.route("/system/upload", methods=["POST"])
19561958
def upload() -> ResponseReturnValue:
1957-
if os.path.isfile(Path(os.environ["DOT_PIOREACTOR"]) / "DISALLOW_UI_UPLOADS"):
1959+
if (Path(os.environ["DOT_PIOREACTOR"]) / "DISALLOW_UI_UPLOADS").is_file():
19581960
abort_with(403, "No UI uploads allowed")
19591961

19601962
if "file" not in request.files:

0 commit comments

Comments
 (0)