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
# slurmctld options
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: >-
{{
'/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else (
'/var/run/slurmctld.pid' if __slurm_redhat else
None)
'/var/run/slurm-llnl/slurmctld.pid' if __slurm_debian else omit
}}
StateSaveLocation: >-
{{
'/var/lib/slurm-llnl/slurmctld' if __slurm_debian else (
'/var/lib/slurm/slurmctld' if __slurm_redhat else
None)
omit)
}}
# slurmd options
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: >-
{{
'/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else (
'/var/run/slurm.pid' if __slurm_redhat else
None)
'/var/run/slurm-llnl/slurmd.pid' if __slurm_debian else omit
}}
SlurmdSpoolDir: >-
{{
'/var/lib/slurm-llnl/slurmd' if __slurm_debian else (
'/var/spool/slurm/slurmd' if __slurm_redhat else
None)
omit)
}}
__slurm_config_merged: "{{ __slurm_config_default | combine(slurm_config | default({})) }}"
@ -83,9 +79,7 @@ __slurmdbd_config_default:
SlurmUser: "{{ __slurm_user_name }}"
PidFile: >-
{{
'/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else (
'/var/run/slurmdbd.pid' if __slurm_redhat else
None)
'/var/run/slurm-llnl/slurmdbd.pid' if __slurm_debian else omit
}}
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({})) }}"

View File

@ -4,7 +4,8 @@
{% set conf = lookup('vars', item.config) %}
{% for key in conf | sort %}
{% if conf[key] != None %}
{{ key }}={{ conf[key] }}
{% set val = 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 %}
{% endfor %}

View File

@ -9,14 +9,15 @@ ControlMachine=localhost
# Configuration options
{% for key in __slurm_config_merged | sort %}
{% if __slurm_config_merged[key] %}
{{ key }}={{ __slurm_config_merged[key] }}
{% set val = __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 %}
{% endfor %}
# 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 %}
NodeName=localhost State=UNKNOWN
@ -24,7 +25,7 @@ NodeName=localhost State=UNKNOWN
# 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 %}
PartitionName=debug Default=YES Nodes={{ (slurm_nodes[0] | default({})).name | default('localhost') }} State=UP