Skip to content

Commit 936b7bf

Browse files
committed
[IMEX] Remove unnecessary condition to skip creation of main and nodes config file.
1 parent 7ffb589 commit 936b7bf

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/partial/_nvidia_imex_common.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@
3939
owner 'root'
4040
group 'root'
4141
mode '0755'
42-
action :create
43-
not_if { file_exists_and_cluster_update?(nvidia_imex_nodes_conf_file) }
42+
action :create_if_missing
4443
end
4544

4645
template nvidia_imex_main_conf_file do
4746
source 'nvidia-imex/nvidia-imex-config.erb'
4847
owner 'root'
4948
group 'root'
5049
mode '0755'
51-
action :create
52-
not_if { file_exists_and_cluster_update?(nvidia_imex_main_conf_file) }
50+
action :create_if_missing
5351
variables(imex_nodes_config_file_path: nvidia_imex_nodes_conf_file)
5452
end
5553

@@ -93,10 +91,6 @@ def nvidia_enabled_or_installed?
9391
nvidia_enabled? || nvidia_installed?
9492
end
9593

96-
def file_exists_and_cluster_update?(file_path)
97-
::File.exist?(file_path) && !are_queues_updated?
98-
end
99-
10094
def nvidia_imex_main_conf_file
10195
"#{node['cluster']['nvidia']['imex']['shared_dir']}/config_#{node['cluster']['launch_template_id']}.cfg"
10296
end

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,13 @@ def self.configure(chef_run)
341341
.with(user: 'root')
342342
.with(group: 'root')
343343
.with(mode: '0755')
344+
.with(action: :create_if_missing)
344345
is_expected.not_to create_template("#{nvidia_imex_shared_dir}/config_#{launch_template_id}.cfg")
345346
.with(source: 'nvidia-imex/nvidia-imex-config.erb')
346347
.with(user: 'root')
347348
.with(group: 'root')
348349
.with(mode: '0755')
350+
.with(action: :create_if_missing)
349351
.with(variables: { imex_nodes_config_file_path: "#{nvidia_imex_shared_dir}/nodes_config_#{launch_template_id}.cfg" })
350352
is_expected.not_to create_template("/etc/systemd/system/nvidia-imex.service")
351353
.with(source: 'nvidia-imex/nvidia-imex.service.erb')
@@ -362,11 +364,13 @@ def self.configure(chef_run)
362364
.with(user: 'root')
363365
.with(group: 'root')
364366
.with(mode: '0755')
367+
.with(action: :create_if_missing)
365368
is_expected.to create_template("#{nvidia_imex_shared_dir}/config_#{launch_template_id}.cfg")
366369
.with(source: 'nvidia-imex/nvidia-imex-config.erb')
367370
.with(user: 'root')
368371
.with(group: 'root')
369372
.with(mode: '0755')
373+
.with(action: :create_if_missing)
370374
.with(variables: { imex_nodes_config_file_path: "#{nvidia_imex_shared_dir}/nodes_config_#{launch_template_id}.cfg" })
371375
is_expected.to create_template("/etc/systemd/system/nvidia-imex.service")
372376
.with(source: 'nvidia-imex/nvidia-imex.service.erb')

0 commit comments

Comments
 (0)