Skip to content

Commit d39131d

Browse files
Make sure the efs access point id array is set properly and the unit tests cover the dna.json values (aws#2792)
1 parent b39929f commit d39131d

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
efs_encryption_in_transit_array [node['cluster']['efs_encryption_in_transits'].split(',')[index]]
6262
efs_iam_authorization_array [node['cluster']['efs_iam_authorizations'].split(',')[index]]
6363
efs_mount_point_array ['/home']
64-
efs_access_point_id [node['cluster']['efs_access_point_ids'].split(',')[index]]
64+
efs_access_point_id_array [node['cluster']['efs_access_point_ids'].split(',')[index]]
6565
action :mount
6666
end
6767
break
@@ -74,7 +74,7 @@
7474
efs_fs_id_array [node['cluster']['efs_fs_ids'].split(',')[index]]
7575
efs_encryption_in_transit_array [node['cluster']['efs_encryption_in_transits'].split(',')[index]]
7676
efs_iam_authorization_array [node['cluster']['efs_iam_authorizations'].split(',')[index]]
77-
efs_access_point_id [node['cluster']['efs_access_point_ids'].split(',')[index]]
77+
efs_access_point_id_array [node['cluster']['efs_access_point_ids'].split(',')[index]]
7878
action :mount
7979
end
8080
break

cookbooks/aws-parallelcluster-environment/resources/efs/partial/_mount_umount.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
mount_options += ",iam"
5151
end
5252
# accesspoint requires tls
53-
if efs_access_point_id && efs_access_point_id != ''
53+
if efs_access_point_id != 'none'
5454
mount_options += ",accesspoint=#{efs_access_point_id}"
5555
end
5656
end

cookbooks/aws-parallelcluster-environment/spec/unit/resources/efs_spec.rb

+16-5
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ def mock_already_installed(package, expected_version, installed)
257257
end
258258
runner.converge_dsl do
259259
efs 'mount' do
260-
efs_fs_id_array %w(id_1 id_2 id_3)
261-
shared_dir_array %w(shared_dir_1 /shared_dir_2 /shared_dir_3)
262-
efs_encryption_in_transit_array %w(true true not_true)
263-
efs_iam_authorization_array %w(not_true true true)
260+
efs_fs_id_array %w(id_1 id_2 id_3 id_4)
261+
shared_dir_array %w(shared_dir_1 /shared_dir_2 /shared_dir_3 /shared_dir_4)
262+
efs_encryption_in_transit_array %w(true true not_true true)
263+
efs_iam_authorization_array %w(not_true true true true)
264+
efs_access_point_id_array %w(none none none ap)
264265
action :mount
265266
end
266267
end
@@ -270,14 +271,15 @@ def mock_already_installed(package, expected_version, installed)
270271
stub_command("mount | grep ' /shared_dir_1 '").and_return(false)
271272
stub_command("mount | grep ' /shared_dir_2 '").and_return(true)
272273
stub_command("mount | grep ' /shared_dir_3 '").and_return(true)
274+
stub_command("mount | grep ' /shared_dir_4 '").and_return(false)
273275
end
274276

275277
it 'mounts efs' do
276278
is_expected.to mount_efs('mount')
277279
end
278280

279281
it 'creates shared directory' do
280-
%w(/shared_dir_1 /shared_dir_2 /shared_dir_3).each do |shared_dir|
282+
%w(/shared_dir_1 /shared_dir_2 /shared_dir_3 /shared_dir_4).each do |shared_dir|
281283
is_expected.to create_directory(shared_dir)
282284
.with(owner: 'root')
283285
.with(group: 'root')
@@ -295,6 +297,15 @@ def mock_already_installed(package, expected_version, installed)
295297
.with(options: %w(_netdev noresvport tls))
296298
.with(retries: 10)
297299
.with(retry_delay: 60)
300+
301+
is_expected.to mount_mount('/shared_dir_4')
302+
.with(device: 'id_4:/')
303+
.with(fstype: 'efs')
304+
.with(dump: 0)
305+
.with(pass: 0)
306+
.with(options: %w(_netdev noresvport tls iam accesspoint=ap))
307+
.with(retries: 10)
308+
.with(retry_delay: 60)
298309
end
299310

300311
it 'enables shared dir mount if already mounted' do

cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_alinux2023.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def default_packages
4141
blas-devel libffi-devel dkms libedit-devel jq
4242
libical-devel sendmail libxml2-devel libglvnd-devel
4343
libgcrypt-devel libevent-devel glibc-static bind-utils
44-
iproute python3 python3-pip libcurl-devel
44+
iproute python3 python3-pip libcurl-devel git
4545
coreutils environment-modules gcc gcc-c++ bzip2 iptables vim yum-plugin-versionlock)
4646
end
4747

0 commit comments

Comments
 (0)