Skip to content

Commit 9ceed59

Browse files
Tim Lanetilne
authored andcommitted
Set MODULEPATH config path based on CentOS version
As part of the change from CentOS 8.2 to CentOS 8.3, the environment modules package installed by default changed from environment-modules-4.1.4-4 to environment-modules-4.5.2-1. According to a changelog from rpmfind.net (linked at the end of this commit message), one of the changes is to 'Make .modulespath a config file'. With this change, it seems the value of the MODULEPATH environment variable (used to tell the `module` command which directories to search) must be configured via /etc/environment-modules/modulespath rather than /usr/share/Modules/init/.modulespath. This commit sets this path dynamically based on the OS in use. Link to info for RPM providing environment-modules-4.5.2-1: http://rpmfind.net/linux/RPM/centos/8-stream/baseos/x86_64/Packages/environment-modules-4.5.2-1.el8.x86_64.html Signed-off-by: Tim Lane <tilne@amazon.com>
1 parent f3915fe commit 9ceed59

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

attributes/default.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,14 @@
254254
default['cfncluster']['modulefile_dir'] = "/usr/share/Modules/modulefiles"
255255
# MODULESHOME
256256
default['cfncluster']['moduleshome'] = "/usr/share/Modules"
257+
# Config file used to set default MODULEPATH list
258+
default['cfncluster']['modulepath_config_file'] = value_for_platform(
259+
'centos' => {
260+
'~>8' => '/etc/environment-modules/modulespath',
261+
'~>7' => "#{node['cfncluster']['moduleshome']}/init/.modulespath"
262+
},
263+
'amazon' => { 'default' => "#{node['cfncluster']['moduleshome']}/init/.modulespath" }
264+
)
257265

258266
case node['platform']
259267
when 'centos', 'redhat', 'scientific' # ~FC024
@@ -336,6 +344,8 @@
336344
default['cfncluster']['modulefile_dir'] = "/usr/share/modules/modulefiles"
337345
# MODULESHOME
338346
default['cfncluster']['moduleshome'] = "/usr/share/modules"
347+
# Config file used to set default MODULEPATH list
348+
default['cfncluster']['modulepath_config_file'] = "#{node['cfncluster']['moduleshome']}/init/.modulespath"
339349
default['cfncluster']['kernel_generic_pkg'] = "linux-generic"
340350
default['cfncluster']['ganglia']['gmond_service'] = 'ganglia-monitor'
341351
default['cfncluster']['ganglia']['httpd_service'] = 'apache2'

recipes/intel_mpi.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
end
4747

4848
append_if_no_line "append intel modules file dir to modules conf" do
49-
path "#{node['cfncluster']['moduleshome']}/init/.modulespath"
49+
path node['cfncluster']['modulepath_config_file']
5050
line "/opt/intel/impi/#{node['cfncluster']['intelmpi']['version']}/intel64/modulefiles/"
5151
end
5252

0 commit comments

Comments
 (0)