Skip to content

Commit fddb9ae

Browse files
authored
Fix DB upgrade machinery (#216)
* use correct interpreter for community.mysql.mysql_query * parameterise * add pexpect system python package
1 parent 133b59e commit fddb9ae

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ for the accounting storage database, e.g. `mysql`. If this is defined this
234234
service is stopped before the backup and restarted after, to allow for physical
235235
backups. Default is the empty string, which does not stop/restart any service.
236236

237+
`openhpc_mysql_interpreter`: Optional. Value of `ansible_python_interpreter`
238+
to use for `community.mysql.mysql_query` module - should be set to whatever
239+
was used to install `pymysql`.
240+
237241
## Facts
238242

239243
This role creates local facts from the live Slurm configuration, which can be

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,4 @@ openhpc_slurm_accounting_storage_backup_cmd: ''
167167
openhpc_slurm_accounting_storage_backup_host: "{{ openhpc_slurm_accounting_storage_host }}"
168168
openhpc_slurm_accounting_storage_backup_become: true
169169
openhpc_slurm_accounting_storage_client_package: mysql
170+
openhpc_mysql_interpreter: /usr/bin/python3.9 # Need non-default python to use installed recent pymysql version, with fixed SQL injection vulnerability

tasks/upgrade.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
query: SHOW TABLES
1212
config_file: ''
1313
register: _openhpc_slurmdb_tables
14+
vars:
15+
ansible_python_interpreter: "{{ openhpc_mysql_interpreter }}"
1416

1517
- name: Check if slurm database requires an upgrade
1618
ansible.builtin.command: slurmdbd -u

vars/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ohpc_slurm_packages:
1717
- "{{ 'lmod-ohpc' if openhpc_module_system_install else '' }}"
1818
database:
1919
- "slurm-slurmdbd-ohpc"
20+
- "python3-pexpect"
2021

2122
openhpc_merged_config: "{{ openhpc_default_config | combine(openhpc_config) }}"
2223
...

0 commit comments

Comments
 (0)