Don't set a pid file on EL, and use omit instead of None as the

default since "{{ None }}" actually becomes an empty string (there isn't
a way to set a variable to None/null from a template block as far as I
can tell).
This commit is contained in:
Nate Coraor 2019-03-27 16:24:43 -04:00
parent 3a61c93590
commit d18c8f91ea
3 changed files with 16 additions and 20 deletions

View File

@ -33,33 +33,29 @@ __slurm_config_default:
ProctrackType: proctrack/pgid ProctrackType: proctrack/pgid
# slurmctld options # slurmctld options
SlurmctldPort: 6817 SlurmctldPort: 6817
SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else None }}" SlurmctldLogFile: "{{ '/var/log/slurm-llnl/slurmctld.log' if __slurm_debian else omit }}"
SlurmctldPidFile: >- SlurmctldPidFile: >-
{{ {{
'/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else ( '/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else omit
'/var/run/slurmctld.pid' if __slurm_redhat else
None)
}} }}
StateSaveLocation: >- StateSaveLocation: >-
{{ {{
'/var/lib/slurm-llnl/slurmctld' if __slurm_debian else ( '/var/lib/slurm-llnl/slurmctld' if __slurm_debian else (
'/var/lib/slurm/slurmctld' if __slurm_redhat else '/var/lib/slurm/slurmctld' if __slurm_redhat else
None) omit)
}} }}
# slurmd options # slurmd options
SlurmdPort: 6818 SlurmdPort: 6818
SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else None }}" SlurmdLogFile: "{{ '/var/log/slurm-llnl/slurmd.log' if __slurm_debian else omit }}"
SlurmdPidFile: >- SlurmdPidFile: >-
{{ {{
'/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else ( '/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else omit
'/var/run/slurm.pid' if __slurm_redhat else
None)
}} }}
SlurmdSpoolDir: >- SlurmdSpoolDir: >-
{{ {{
'/var/lib/slurm-llnl/slurmd' if __slurm_debian else ( '/var/lib/slurm-llnl/slurmd' if __slurm_debian else (
'/var/spool/slurm/slurmd' if __slurm_redhat else '/var/spool/slurm/slurmd' if __slurm_redhat else
None) omit)
}} }}
__slurm_config_merged: "{{ __slurm_config_default | combine(slurm_config | default({})) }}" __slurm_config_merged: "{{ __slurm_config_default | combine(slurm_config | default({})) }}"
@ -83,9 +79,7 @@ __slurmdbd_config_default:
SlurmUser: "{{ __slurm_user_name }}" SlurmUser: "{{ __slurm_user_name }}"
PidFile: >- PidFile: >-
{{ {{
'/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else ( '/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else omit
'/var/run/slurmdbd.pid' if __slurm_redhat else
None)
}} }}
LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else None }}" LogFile: "{{ '/var/log/slurm-llnl/slurmdbd.log' if __slurm_debian else omit }}"
__slurmdbd_config_merged: "{{ __slurmdbd_config_default | combine(slurmdbd_config | default({})) }}" __slurmdbd_config_merged: "{{ __slurmdbd_config_default | combine(slurmdbd_config | default({})) }}"

View File

@ -4,7 +4,8 @@
{% set conf = lookup('vars', item.config) %} {% set conf = lookup('vars', item.config) %}
{% for key in conf | sort %} {% for key in conf | sort %}
{% if conf[key] != None %} {% set val = conf[key] %}
{{ key }}={{ conf[key] }} {% if val is not none and val != omit %}
{{ key }}={{ 'yes' if val is sameas true else ('no' if val is sameas false else val) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -9,14 +9,15 @@ ControlMachine=localhost
# Configuration options # Configuration options
{% for key in __slurm_config_merged | sort %} {% for key in __slurm_config_merged | sort %}
{% if __slurm_config_merged[key] %} {% set val = __slurm_config_merged[key] %}
{{ key }}={{ __slurm_config_merged[key] }} {% if val is not none and val != omit %}
{{ key }}={{ 'YES' if val is sameas true else ('NO' if val is sameas false else val) }}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
# Nodes # Nodes
{% for i in slurm_nodes %} {% for i in slurm_nodes %}
NodeName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ i[k] }}{% endfor %} NodeName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ 'YES' if i[k] is sameas true else ('NO' if i[k] is sameas false else i[k]) }}{% endfor %}
{% else %} {% else %}
NodeName=localhost State=UNKNOWN NodeName=localhost State=UNKNOWN
@ -24,7 +25,7 @@ NodeName=localhost State=UNKNOWN
# Partitions # Partitions
{% for i in slurm_partitions %} {% for i in slurm_partitions %}
PartitionName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ i[k] }}{% endfor %} PartitionName={{ i.name }}{% for k in i | sort if k != 'name' %} {{ k }}={{ 'YES' if i[k] is sameas true else ('NO' if i[k] is sameas false else i[k]) }}{% endfor %}
{% else %} {% else %}
PartitionName=debug Default=YES Nodes={{ (slurm_nodes[0] | default({})).name | default('localhost') }} State=UP PartitionName=debug Default=YES Nodes={{ (slurm_nodes[0] | default({})).name | default('localhost') }} State=UP