-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SVCPLAN-6599: mailprog.sh email wrapper for scheduler
If profile_slurm::scheduler::mailprog::sendas_address is specified, create an /etc/slurm/mailprog.sh script that can be used as MailProg in slurm.conf.
- Loading branch information
1 parent
2fe8257
commit 9b6885d
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# @summary Creates a mailprog.sh script that can be used as MailProg in slurm.conf. | ||
# | ||
# Creates a mailprog.sh script that can be used as MailProg in slurm.conf. MailProg | ||
# must still be set in slurm.conf using the slurm Puppet module. | ||
# | ||
# @param sendas_address | ||
# Email address that should be used to send email (the FROM address). | ||
# THIS PARAMETER MUST BE DEFINED TO CREATE THE SCRIPT! | ||
# | ||
# @example | ||
# include profile_slurm::scheduler::mailprog | ||
class profile_slurm::scheduler::mailprog ( | ||
$sendas_address, | ||
) { | ||
# create the mailprog.sh script | ||
if $sendas_address { | ||
file { '/etc/slurm/mailprog.sh': | ||
ensure => file, | ||
content => epp( 'profile_slurm/mailprog.sh.epp' ), | ||
owner => 'root', | ||
group => 'root', | ||
mode => '0755', | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'profile_slurm::scheduler::mailprog' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os}" do | ||
let(:facts) { os_facts } | ||
|
||
it { is_expected.to compile.with_all_deps } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# mailprog.sh: Managed by Puppet | ||
|
||
# SCRIPT ARGS SENT BY SLURM: | ||
# first arg is '-s' | ||
# last arg is recipient email address | ||
recipient=${@: -1} | ||
# all middle args are the subject | ||
subject=${@:2:$#-2} | ||
|
||
# send email with empty body and appropriate subject to the recipient | ||
echo "" | /bin/mail -r <%= $profile_slurm::scheduler::mailprog::sendas_address %> -s "$subject" $recipient |