Skip to content

Commit 362e3fc

Browse files
committed
explain upgrade logic
1 parent 1a55f61 commit 362e3fc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tasks/upgrade.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020
_openhpc_slurmdbd_check.rc > 1 or
2121
'Slurm Database is somehow higher than expected' in _openhpc_slurmdbd_check.stdout
2222
# from https://github.com/SchedMD/slurm/blob/master/src/plugins/accounting_storage/mysql/as_mysql_convert.c
23-
when: _openhpc_slurmdb_tables.query_result != [[]] # i.e. when db is initialised
23+
when: _openhpc_slurmdb_tables.query_result | flatten | length > 0 # i.e. when db is initialised
2424

2525
- name: Set fact for slurm database upgrade
26-
# If -u option doesn't exist it can't be a major upgrade due to existing
27-
# appliance version
28-
# Otherwise from manpage, rc 0 = no conversion, 1 = conversion required
29-
# Default skips upgrade steps if skipped check because db is not initialised
26+
# Explanation of ifs below:
27+
# - `slurmdbd -u` rc == 0 then no conversion required (from manpage)
28+
# - default of 0 on rc skips upgrade steps if check was skipped because
29+
# db is not initialised
30+
# - Usage message (and rc == 1) if -u option doesn't exist, in which case
31+
# it can't be a major upgrade due to existing openhpc versions
3032
set_fact:
3133
_openhpc_slurmdb_upgrade: >-
3234
{{ false
@@ -52,7 +54,7 @@
5254
cmd: "{{ openhpc_slurm_accounting_storage_backup_cmd }}"
5355
delegate_to: "{{ openhpc_slurm_accounting_storage_backup_host }}"
5456
become: "{{ openhpc_slurm_accounting_storage_backup_become }}"
55-
changed_when: true # limt no-changed-when
57+
changed_when: true
5658
run_once: true
5759
when:
5860
- _openhpc_slurmdb_upgrade

0 commit comments

Comments
 (0)