def set_hostname()

in azure-slurm-install/install.py [0:0]


def set_hostname(s: InstallSettings) -> None:
    if not s.use_nodename_as_hostname:
        return

    if s.is_primary_scheduler:
        return

    new_hostname = s.node_name.lower()
    if s.mode != "execute" and not new_hostname.startswith(s.node_name_prefix):
        new_hostname = f"{s.node_name_prefix}{new_hostname}"

    ilib.set_hostname(
        new_hostname, s.platform_family, s.ensure_waagent_monitor_hostname
    )
    if _is_at_least_ubuntu22() and s.ubuntu22_waagent_fix:
        logging.warning("Restarting systemd-networkd to fix waagent/hostname issue on Ubuntu 22.04." +
                        " To disable this, set slurm.ubuntu22_waagent_fix=false under this" +
                        " node/nodearray's [[[configuration]]] section")
        subprocess.check_call(["systemctl", "restart", "systemd-networkd"])