From 450da982cc05747981ee075a3c1915126d195855 Mon Sep 17 00:00:00 2001 From: Jacopo De Amicis <35738823+jdeamicis@users.noreply.github.com> Date: Mon, 17 Apr 2023 11:51:42 +0200 Subject: [PATCH] Fix Slurm accounting password being overridden at queue update (#2006) Fix a bug that caused the slurmdbd database password to be overridden during a cluster update where the queues were being updated and the Slurm accounting configuration was not being modified. Signed-off-by: Jacopo De Amicis --- CHANGELOG.md | 1 + .../recipes/update_head_node.rb | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6723bd6f..89c200072 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ This file is used to list changes made in each version of the AWS ParallelCluste **BUG FIXES** - Fix IP association on instances with multiple network cards. +- Fix replacement of StoragePass in slurm_parallelcluster_slurmdbd.conf when a queue parameter update is performed and the Slurm accounting configurations are not updated. **BUG FIXES** - Fix issue causing cfn-hup daemon to fail when it gets restarted. diff --git a/cookbooks/aws-parallelcluster-slurm/recipes/update_head_node.rb b/cookbooks/aws-parallelcluster-slurm/recipes/update_head_node.rb index d56a0af0c..a6e9ce20a 100644 --- a/cookbooks/aws-parallelcluster-slurm/recipes/update_head_node.rb +++ b/cookbooks/aws-parallelcluster-slurm/recipes/update_head_node.rb @@ -160,6 +160,16 @@ def update_nodes_in_queue(strategy, queues) not_if { ::File.exist?(node['cluster']['previous_cluster_config_path']) && !are_queues_updated? } end +# The previous execute resource may have overridden the slurmdbd password in slurm_parallelcluster_slurmdbd.conf with +# a default value, so if it has run and Slurm accounting is enabled we must pull the database password from Secrets +# Manager once again. +execute "update Slurm database password" do + user 'root' + group 'root' + command "#{node['cluster']['scripts_dir']}/slurm/update_slurm_database_password.sh" + not_if { ::File.exist?(node['cluster']['previous_cluster_config_path']) && !are_queues_updated? && node['cluster']['config'].dig(:Scheduling, :SlurmSettings, :Database).nil? } +end + # Generate custom Slurm settings include files execute "generate_pcluster_custom_slurm_settings_include_files" do command "#{node['cluster']['cookbook_virtualenv_path']}/bin/python #{node['cluster']['scripts_dir']}/slurm/pcluster_custom_slurm_settings_include_file_generator.py" \