diff --git a/CHANGELOG.md b/CHANGELOG.md index c670abcd..2ad9c318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 interpreted by frontend and emit clear error message in logs (#321). - Detect responses from slurmrestd not formatted in JSON, translated into JSON error for frontend and emit clear error message in logs (#333). + - Detect absence of _warnings_ key in `slurmrestd` responses and emit warning + log instead of crashing (#316). - genjwt: fix portability to Python < 3.8 in debug message. - ldap-check: fix usage of `user_name_attribute` configuration parameter (#340). - frontend: diff --git a/slurmweb/views/agent.py b/slurmweb/views/agent.py index 877e5c6e..419fc88e 100644 --- a/slurmweb/views/agent.py +++ b/slurmweb/views/agent.py @@ -92,7 +92,13 @@ def slurmrest(query, key, handle_errors=True): error["description"], error["source"], ) - if len(result["warnings"]): + if "warnings" not in result: + logger.error( + "Unable to extract warnings from slurmrestd response to %s, unsupported " + "Slurm version?", + query, + ) + elif len(result["warnings"]): logger.warning("slurmrestd query %s warnings: %s", query, result["warnings"]) return result[key]