diff --git a/charms/slurmctld/src/charm.py b/charms/slurmctld/src/charm.py index 187154d..8171f79 100755 --- a/charms/slurmctld/src/charm.py +++ b/charms/slurmctld/src/charm.py @@ -391,7 +391,7 @@ def _resume_nodes(self, nodelist: List[str]) -> None: """Run scontrol to resume the specified node list.""" nodes = ",".join(nodelist) update_cmd = f"update nodename={nodes} state=resume" - self._slurmctld.scontrol(update_cmd) + self._slurmctld.scontrol(*shlex.split(update_cmd)) @property def _cluster_name(self) -> str: diff --git a/charms/slurmctld/tests/unit/test_charm.py b/charms/slurmctld/tests/unit/test_charm.py index 29fc2bc..70532ea 100644 --- a/charms/slurmctld/tests/unit/test_charm.py +++ b/charms/slurmctld/tests/unit/test_charm.py @@ -168,3 +168,12 @@ def test_get_user_supplied_parameters(self, *_) -> None: self.harness.charm._assemble_slurm_conf().job_acct_gather_frequency, "task=30,network=40", ) + + def test_resume_nodes_valid_input(self) -> None: + """Test that the _resume_nodes method provides a valid scontrol command.""" + self.harness.charm._slurmctld.scontrol = Mock() + self.harness.charm._resume_nodes(["juju-123456-1", "tester-node", "node-three"]) + args, _ = self.harness.charm._slurmctld.scontrol.call_args + self.assertEqual( + args, ("update", "nodename=juju-123456-1,tester-node,node-three", "state=resume") + )