stackhpc / ansible-role-openhpc

Ansible role for OpenHPC
Apache License 2.0
44 stars 15 forks source link

Fix slurm.conf inventory filtering for nodenames with padding #143

Closed sjpb closed 1 year ago

sjpb commented 1 year ago

The hostlist_expression filter is used to convert a list of hostnames from an inventory group into a nice short slurm hostlist expression IF those hosts have a numerical suffix. However currently it doesn't cope with padding, e.g. [compute-001, compute-002] gets converted into compute-[0-2] which breaks slurm (as those aren't actually the hostnames).

This PR fixes this and copes even with a pretty pathological case (see example in docstring below).