Skip to content

Commit

Permalink
Add some prints in the rotation script
Browse files Browse the repository at this point in the history
  • Loading branch information
hehe7318 committed Sep 11, 2023
1 parent 45224cd commit 9af2561
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions cookbooks/aws-parallelcluster-slurm/libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def restart_munge_service
end

def setup_munge_head_node
# Generate munge key or get it's value from secrets manager
munge_key_manager 'manage_munge_key' do
munge_key_secret_arn lazy {
node['cluster']['config'].dig(:DevSettings, :SlurmSettings, :MungeKeySecretArn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ CLUSTER_USER="<%= @cluster_user %>"

# If SECRET_ARN is provided, fetch the munge key from Secrets Manager
if [ -n "${SECRET_ARN}" ]; then
# Remove current munge key if exists
if [ -f "${MUNGE_KEY_FILE}" ]; then
rm -f ${MUNGE_KEY_FILE}
fi

echo "Fetching munge key from AWS Secrets Manager: ${SECRET_ARN}"
encoded_key=$(aws secretsmanager get-secret-value --secret-id ${SECRET_ARN} --query 'SecretString' --output text --region ${REGION})

Expand All @@ -37,6 +32,11 @@ if [ -n "${SECRET_ARN}" ]; then
exit 1
fi

# Remove current munge key if exists
if [ -f "${MUNGE_KEY_FILE}" ]; then
rm -f ${MUNGE_KEY_FILE}
fi

echo "${decoded_key}" > ${MUNGE_KEY_FILE}

# Set ownership on the key
Expand All @@ -51,10 +51,14 @@ fi

# Enable and restart munge service
systemctl enable munge
echo "Start to Restart munge service"
systemctl restart munge || { sleep 10; systemctl restart munge; } || { sleep 10; systemctl restart munge; } || { sleep 10; systemctl restart munge; } || { sleep 10; systemctl restart munge; }
echo "Restart munge service completed"

# Share munge key
echo "Start to Share munge key"
mkdir -p /home/${CLUSTER_USER}/.munge
cp /etc/munge/munge.key /home/${CLUSTER_USER}/.munge/.munge.key
echo "Share munge key completed"

exit 0

0 comments on commit 9af2561

Please sign in to comment.