remove disable script protection
This commit is contained in:
@@ -9,7 +9,7 @@ Files in this folder are treated as protected example scripts by the API:
|
|||||||
Protected behavior:
|
Protected behavior:
|
||||||
|
|
||||||
- scripts are synced from this folder into `/srv/fw-scripts` on backend startup
|
- scripts are synced from this folder into `/srv/fw-scripts` on backend startup
|
||||||
- scripts in this folder cannot be overwritten, disabled, or deleted via the API
|
- scripts in this folder cannot be overwritten, edited, or deleted via the API
|
||||||
- scripts with a deploy config containing `qnum` are auto-started as systemd services
|
- scripts with a deploy config containing `qnum` are auto-started as systemd services
|
||||||
|
|
||||||
Example deploy file:
|
Example deploy file:
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"qnum": 1,
|
|
||||||
"enable_at_boot": true
|
|
||||||
}
|
|
||||||
@@ -926,8 +926,6 @@ def enable_script(name: str, req: EnableRequest) -> OperationResult:
|
|||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise HTTPException(status_code=400, detail=str(e))
|
raise HTTPException(status_code=400, detail=str(e))
|
||||||
|
|
||||||
assert_not_example_script(name, "manually enabled")
|
|
||||||
|
|
||||||
script_path = script_path_for(name)
|
script_path = script_path_for(name)
|
||||||
if not os.path.exists(script_path):
|
if not os.path.exists(script_path):
|
||||||
raise HTTPException(status_code=404, detail="script not found")
|
raise HTTPException(status_code=404, detail="script not found")
|
||||||
@@ -968,8 +966,6 @@ def disable_script(name: str, qnum: int) -> OperationResult:
|
|||||||
validate_name(name)
|
validate_name(name)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise HTTPException(status_code=400, detail=str(e))
|
raise HTTPException(status_code=400, detail=str(e))
|
||||||
|
|
||||||
assert_not_example_script(name, "disabled")
|
|
||||||
service_name = make_service_name(name, qnum)
|
service_name = make_service_name(name, qnum)
|
||||||
# attempt stop + remove via systemctl-based remove_unit
|
# attempt stop + remove via systemctl-based remove_unit
|
||||||
try:
|
try:
|
||||||
@@ -1102,4 +1098,4 @@ def register_lifecycle(app) -> None:
|
|||||||
remove_unit(svc)
|
remove_unit(svc)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Failed to remove unit %s on shutdown", svc)
|
logger.exception("Failed to remove unit %s on shutdown", svc)
|
||||||
logger.info("Shutdown cleanup complete")
|
logger.info("Shutdown cleanup complete")
|
||||||
|
|||||||
Reference in New Issue
Block a user