Skip to content

Commit 01fb01e

Browse files
Move files out of /tmp
Signed-off-by: Hanwen <[email protected]>
1 parent 89e4c46 commit 01fb01e

File tree

16 files changed

+45
-43
lines changed

16 files changed

+45
-43
lines changed

cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def cidr_to_netmask(cidr)
6666

6767
cookbook_file 'configure_nw_interface.sh' do
6868
source 'network_interfaces/configure_nw_interface.sh'
69-
path '/tmp/configure_nw_interface.sh'
69+
path "#{node['cluster']['tmp_dir']}/configure_nw_interface.sh"
7070
user 'root'
7171
group 'root'
7272
mode '0644'
@@ -87,7 +87,7 @@ def cidr_to_netmask(cidr)
8787
execute 'configure_nw_interface' do
8888
user 'root'
8989
group 'root'
90-
cwd "/tmp"
90+
cwd node['cluster']['tmp_dir']
9191
environment(
9292
# TODO: The variables are a superset of what's required by individual scripts. Consider simplification.
9393
'DEVICE_NAME' => device_name,
@@ -101,7 +101,7 @@ def cidr_to_netmask(cidr)
101101
'MAC' => mac
102102
)
103103

104-
command 'sh /tmp/configure_nw_interface.sh'
104+
command "sh #{node['cluster']['tmp_dir']}/configure_nw_interface.sh"
105105
end
106106
end
107107

cookbooks/aws-parallelcluster-environment/recipes/install/cfn_bootstrap.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
bucket = "s3.#{aws_region}.#{aws_domain}"
6666
end
6767

68-
remote_file "/tmp/#{cfnbootstrap_package}" do
68+
remote_file "#{node['cluster']['tmp_dir']}/#{cfnbootstrap_package}" do
6969
source "https://#{bucket}/cloudformation-examples/#{cfnbootstrap_package}"
7070
retries 3
7171
retry_delay 5
@@ -74,7 +74,7 @@
7474
bash "Install CloudFormation helpers from #{cfnbootstrap_package}" do
7575
user 'root'
7676
group 'root'
77-
cwd '/tmp'
77+
cwd node['cluster']['tmp_dir']
7878
code "#{virtualenv_path}/bin/pip install #{cfnbootstrap_package}"
7979
creates "#{virtualenv_path}/bin/cfn-hup"
8080
end

cookbooks/aws-parallelcluster-environment/spec/unit/recipes/cfn_bootstrap_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
end
4747

4848
it 'downloads cfn_bootstrap package from s3' do
49-
is_expected.to create_remote_file("/tmp/#{cfnbootstrap_package}").with(
49+
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/#{cfnbootstrap_package}").with(
5050
source: "https://s3.amazonaws.com/cloudformation-examples/#{cfnbootstrap_package}"
5151
)
5252
end
@@ -55,7 +55,7 @@
5555
is_expected.to run_bash("Install CloudFormation helpers from #{cfnbootstrap_package}").with(
5656
user: 'root',
5757
group: 'root',
58-
cwd: '/tmp',
58+
cwd: node['cluster']['tmp_dir'],
5959
code: "#{virtualenv_path}/bin/pip install #{cfnbootstrap_package}",
6060
creates: "#{virtualenv_path}/bin/cfn-hup"
6161
)
@@ -111,7 +111,7 @@
111111
runner.converge(described_recipe)
112112
end
113113
it 'downloads cfn_bootstrap package from a different s3 bucket' do
114-
is_expected.to create_remote_file("/tmp/#{cfnbootstrap_package}").with(
114+
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/#{cfnbootstrap_package}").with(
115115
source: "https://s3.cn-north-1.amazonaws.com.cn/cn-north-1-aws-parallelcluster/cloudformation-examples/#{cfnbootstrap_package}"
116116
)
117117
end

cookbooks/aws-parallelcluster-environment/test/controls/network_interfaces_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
control 'network_interfaces_configuration_script_created' do
1313
title 'Check script to configure network interface is created'
1414

15-
describe file('/tmp/configure_nw_interface.sh') do
15+
describe file("#{node['cluster']['tmp_dir']}/configure_nw_interface.sh") do
1616
it { should exist }
1717
its('mode') { should cmp '0644' }
1818
its('owner') { should eq 'root' }

cookbooks/aws-parallelcluster-platform/files/ami_cleanup.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
cloud-init clean -s
55

66
rm -rf /var/tmp/* /tmp/*
7+
rm -rf node['cluster']['tmp_dir']
78
rm -rf /etc/ssh/ssh_host_*
89
rm -f /etc/udev/rules.d/70-persistent-net.rules
910
grep -l "Created by cloud-init on instance boot automatically" /etc/sysconfig/network-scripts/ifcfg-* | xargs rm -f

cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
cuda_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/cuda/cuda_#{cuda_complete_version}_#{cuda_version_suffix}_#{cuda_arch}.run"
2828
cuda_samples_version = '12.4'
2929
cuda_samples_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/cuda/samples/v#{cuda_samples_version}.tar.gz"
30-
tmp_cuda_run = '/tmp/cuda.run'
31-
tmp_cuda_sample_archive = '/tmp/cuda-sample.tar.gz'
30+
tmp_cuda_run = "#{node['cluster']['tmp_dir']}/cuda.run"
31+
tmp_cuda_sample_archive = "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz"
3232

3333
node.default['cluster']['nvidia']['cuda']['version'] = cuda_version
3434
node.default['cluster']['nvidia']['cuda_samples_version'] = cuda_samples_version
@@ -47,13 +47,13 @@
4747
bash 'cuda.run advanced' do
4848
user 'root'
4949
group 'root'
50-
cwd '/tmp'
50+
cwd node['cluster']['tmp_dir']
5151
code <<-CUDA
5252
set -e
5353
mkdir /cuda-install
5454
./cuda.run --silent --toolkit --samples --tmpdir=/cuda-install
5555
rm -rf /cuda-install
56-
rm -f /tmp/cuda.run
56+
rm -f #{node['cluster']['tmp_dir']}/cuda.run
5757
CUDA
5858
creates "/usr/local/cuda-#{cuda_version}"
5959
end
@@ -71,11 +71,11 @@
7171
bash 'cuda.sample install' do
7272
user 'root'
7373
group 'root'
74-
cwd '/tmp'
74+
cwd node['cluster']['tmp_dir']
7575
code <<-CUDA
7676
set -e
77-
tar xf "/tmp/cuda-sample.tar.gz" --directory "/usr/local/"
78-
rm -f "/tmp/cuda-sample.tar.gz"
77+
tar xf "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz" --directory "/usr/local/"
78+
rm -f "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz"
7979
CUDA
8080
creates "/usr/local/cuda-#{cuda_version}/samples"
8181
end

cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/partial/_nvidia_driver_common.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
property :nvidia_driver_version, String
1919

20-
tmp_nvidia_run = '/tmp/nvidia.run'
20+
tmp_nvidia_run = "#{node['cluster']['tmp_dir']}/nvidia.run"
2121

2222
action :setup do
2323
return unless nvidia_driver_enabled?
@@ -76,11 +76,11 @@
7676
bash 'nvidia.run advanced' do
7777
user 'root'
7878
group 'root'
79-
cwd '/tmp'
79+
cwd node['cluster']['tmp_dir']
8080
code <<-NVIDIA
8181
set -e
8282
#{compiler_path} ./nvidia.run --silent --dkms --disable-nouveau -m=#{nvidia_kernel_module}
83-
rm -f /tmp/nvidia.run
83+
rm -f #{node['cluster']['tmp_dir']}/nvidia.run
8484
NVIDIA
8585
creates '/usr/bin/nvidia-smi'
8686
end

cookbooks/aws-parallelcluster-platform/spec/unit/recipes/cuda_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
end
4040

4141
it 'downloads CUDA run file' do
42-
is_expected.to create_remote_file('/tmp/cuda.run').with(
42+
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/cuda.run").with(
4343
source: cuda_url,
4444
mode: '0755',
4545
retries: 3,
@@ -53,16 +53,16 @@
5353
.with(
5454
user: 'root',
5555
group: 'root',
56-
cwd: '/tmp',
56+
cwd: node['cluster']['tmp_dir'],
5757
creates: "/usr/local/cuda-#{cuda_version}")
5858
.with_code(%r{mkdir /cuda-install})
5959
.with_code(%r{./cuda.run --silent --toolkit --samples --tmpdir=/cuda-install})
6060
.with_code(%r{rm -rf /cuda-install})
61-
.with_code(%r{rm -f /tmp/cuda.run})
61+
.with_code(%r{rm -f #{node['cluster']['tmp_dir']}/cuda.run})
6262
end
6363

6464
it 'downloads CUDA sample files' do
65-
is_expected.to create_remote_file('/tmp/cuda-sample.tar.gz').with(
65+
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz").with(
6666
source: cuda_samples_url,
6767
mode: '0644',
6868
retries: 3,
@@ -75,9 +75,9 @@
7575
.with(
7676
user: 'root',
7777
group: 'root',
78-
cwd: '/tmp')
79-
.with_code(%r{tar xf "/tmp/cuda-sample.tar.gz" --directory "/usr/local/"})
80-
.with_code(%r{rm -f "/tmp/cuda-sample.tar.gz"})
78+
cwd: node['cluster']['tmp_dir'])
79+
.with_code(%r{tar xf "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz" --directory "/usr/local/"})
80+
.with_code(%r{rm -f "#{node['cluster']['tmp_dir']}/cuda-sample.tar.gz"})
8181
end
8282
end
8383

@@ -95,7 +95,7 @@
9595
cached(:node) { chef_run.node }
9696

9797
it 'downloads CUDA run file' do
98-
is_expected.to create_remote_file('/tmp/cuda.run').with_source(cuda_url)
98+
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/cuda.run").with_source(cuda_url)
9999
end
100100
end
101101
end

cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def self.setup(chef_run, nvidia_driver_version: nil)
198198
end
199199

200200
it 'downloads nvidia driver' do
201-
is_expected.to create_remote_file('/tmp/nvidia.run').with(
201+
is_expected.to create_remote_file("#{node['cluster']['tmp_dir']}/nvidia.run").with(
202202
source: nvidia_driver_url,
203203
mode: '0755',
204204
retries: 3,
@@ -241,11 +241,11 @@ def self.setup(chef_run, nvidia_driver_version: nil)
241241
.with(
242242
user: 'root',
243243
group: 'root',
244-
cwd: '/tmp',
244+
cwd: node['cluster']['tmp_dir'],
245245
creates: '/usr/bin/nvidia-smi'
246246
)
247247
.with_code(%r{CC=/usr/bin/gcc10-gcc ./nvidia.run --silent --dkms --disable-nouveau -m=#{kernel_module}})
248-
.with_code(%r{rm -f /tmp/nvidia.run})
248+
.with_code(%r{rm -f #{node['cluster']['tmp_dir']}/nvidia.run})
249249
end
250250
elsif platform == 'ubuntu' && version == '22.04'
251251
it 'installs gcc' do
@@ -269,7 +269,7 @@ def self.setup(chef_run, nvidia_driver_version: nil)
269269
.with(
270270
user: 'root',
271271
group: 'root',
272-
cwd: '/tmp',
272+
cwd: node['cluster']['tmp_dir'],
273273
creates: '/usr/bin/nvidia-smi'
274274
)
275275
.with_code(%r{#{compiler_path} ./nvidia.run --silent --dkms --disable-nouveau -m=#{kernel_module}})
@@ -283,11 +283,11 @@ def self.setup(chef_run, nvidia_driver_version: nil)
283283
.with(
284284
user: 'root',
285285
group: 'root',
286-
cwd: '/tmp',
286+
cwd: node['cluster']['tmp_dir'],
287287
creates: '/usr/bin/nvidia-smi'
288288
)
289289
.with_code(%r{./nvidia.run --silent --dkms --disable-nouveau -m=#{kernel_module}})
290-
.with_code(%r{rm -f /tmp/nvidia.run})
290+
.with_code(%r{rm -f #{node['cluster']['tmp_dir']}/nvidia.run})
291291
end
292292
end
293293

cookbooks/aws-parallelcluster-shared/attributes/cluster.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
default['cluster']['base_dir'] = '/opt/parallelcluster'
22
default['cluster']['sources_dir'] = "#{node['cluster']['base_dir']}/sources"
33
default['cluster']['scripts_dir'] = "#{node['cluster']['base_dir']}/scripts"
4+
default['cluster']['tmp_dir'] = "#{node['cluster']['base_dir']}/tmp"
45
default['cluster']['license_dir'] = "#{node['cluster']['base_dir']}/licenses"
56
default['cluster']['configs_dir'] = "#{node['cluster']['base_dir']}/configs"
67
default['cluster']['shared_dir'] = "#{node['cluster']['base_dir']}/shared"

cookbooks/aws-parallelcluster-slurm/recipes/install/install_pyxis.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
user 'root'
3838
code <<-PYXIS_INSTALL
3939
set -e
40-
tar xf #{pyxis_tarball} -C /tmp
41-
cd /tmp/pyxis-#{pyxis_version}
40+
tar xf #{pyxis_tarball} -C #{node['cluster']['tmp_dir']}
41+
cd #{node['cluster']['tmp_dir']}/pyxis-#{pyxis_version}
4242
CPPFLAGS='-I #{node['cluster']['slurm']['install_dir']}/include/' make
4343
CPPFLAGS='-I #{node['cluster']['slurm']['install_dir']}/include/' make install
4444
PYXIS_INSTALL

cookbooks/aws-parallelcluster-slurm/resources/munge_key_manager.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def generate_munge_key
7474
declare_resource(:bash, 'generate_munge_key') do
7575
user node['cluster']['munge']['user']
7676
group node['cluster']['munge']['group']
77-
cwd '/tmp'
77+
cwd node['cluster']['tmp_dir']
7878
code <<-GENERATE_KEY
7979
set -e
8080
/usr/sbin/mungekey --verbose --force

cookbooks/aws-parallelcluster-slurm/resources/mysql_client/partial/_setup_rhel_based.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
action :setup do
1717
mysql_archive_url = package_archive(node['cluster']['artifacts_s3_url'])
18-
mysql_tar_file = "/tmp/#{package_filename}"
18+
mysql_tar_file = "#{node['cluster']['tmp_dir']}/#{package_filename}"
1919

2020
log "Downloading MySQL packages archive from #{mysql_archive_url}"
2121

@@ -33,7 +33,7 @@
3333
bash 'Install MySQL packages' do
3434
user 'root'
3535
group 'root'
36-
cwd '/tmp'
36+
cwd node['cluster']['tmp_dir']
3737
code <<-MYSQL
3838
set -e
3939

cookbooks/aws-parallelcluster-slurm/spec/unit/recipes/install_pyxis_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
retry_delay: 5,
5555
code: <<-CODE
5656
set -e
57-
tar xf #{cluster_sources_dir}/pyxis-#{pyxis_version}.tar.gz -C /tmp
58-
cd /tmp/pyxis-#{pyxis_version}
57+
tar xf #{cluster_sources_dir}/pyxis-#{pyxis_version}.tar.gz -C #{node['cluster']['tmp_dir']}
58+
cd #{node['cluster']['tmp_dir']}/pyxis-#{pyxis_version}
5959
CPPFLAGS='-I #{slurm_install_dir}/include/' make
6060
CPPFLAGS='-I #{slurm_install_dir}/include/' make install
6161
CODE

cookbooks/aws-parallelcluster-slurm/spec/unit/resources/mysql_client_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def self.validate(chef_run)
4646
end
4747
end
4848
cached(:package_archive) { "#{s3_url}/mysql/#{package_platform}/#{package_filename}" }
49-
cached(:tarfile) { "/tmp/mysql-community-client-#{package_version}.tar.gz" }
49+
cached(:tarfile) { "#{node['cluster']['tmp_dir']}/mysql-community-client-#{package_version}.tar.gz" }
5050
cached(:repository_packages) do
5151
if platform == 'ubuntu'
5252
if version.to_i == 18
@@ -87,7 +87,7 @@ def self.validate(chef_run)
8787
is_expected.to run_bash('Install MySQL packages')
8888
.with(user: 'root')
8989
.with(group: 'root')
90-
.with(cwd: '/tmp')
90+
.with(cwd: node['cluster']['tmp_dir'])
9191
.with(code: %{ set -e
9292
9393
EXTRACT_DIR=$(mktemp -d --tmpdir mysql.XXXXXXX)

cookbooks/aws-parallelcluster-slurm/test/controls/retrieve_remote_custom_settings_file_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
control 'custom_settings_file_retrieved' do
1919
title 'Checks that customs settings file has been retrieved if specified in the config'
2020

21-
describe file("/tmp/custom_slurm_settings_include_file_slurm.conf") do
21+
describe file("#{node['cluster']['tmp_dir']}/custom_slurm_settings_include_file_slurm.conf") do
2222
it { should exist }
2323
end
2424
end

0 commit comments

Comments
 (0)