From 27a0e47384eca584def7016fd82343eab29dec35 Mon Sep 17 00:00:00 2001 From: Himani Deshpande Date: Mon, 4 Mar 2024 18:52:33 -0500 Subject: [PATCH] [DFSM]Using .login_nodes_keys_sync_file to be used during Init and Update phase of the clusters --- .../attributes/environment.rb | 1 + .../recipes/config/login_nodes_keys.rb | 2 +- .../spec/unit/recipes/login_nodes_keys_spec.rb | 6 +++--- cookbooks/aws-parallelcluster-shared/libraries/helpers.rb | 7 +++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cookbooks/aws-parallelcluster-environment/attributes/environment.rb b/cookbooks/aws-parallelcluster-environment/attributes/environment.rb index a907a4d0f5..d65fb41166 100644 --- a/cookbooks/aws-parallelcluster-environment/attributes/environment.rb +++ b/cookbooks/aws-parallelcluster-environment/attributes/environment.rb @@ -55,6 +55,7 @@ default['cluster']['shared_dir_compute'] = node['cluster']['shared_dir'] default['cluster']['shared_dir_head'] = node['cluster']['shared_dir'] default['cluster']['shared_dir_login'] = node['cluster']['shared_dir_login_nodes'] +default['cluster']['shared_login_nodes_keys_sync_file'] = "#{node['cluster']['shared_dir_login_nodes']}/.login_nodes_keys_sync_file" # Since this is a shared directory, it needs to be defined here first instead of in the dependent cookbook for slurm default['cluster']['slurm']['install_dir'] = '/opt/slurm' diff --git a/cookbooks/aws-parallelcluster-environment/recipes/config/login_nodes_keys.rb b/cookbooks/aws-parallelcluster-environment/recipes/config/login_nodes_keys.rb index e30df9877c..6542a786f2 100644 --- a/cookbooks/aws-parallelcluster-environment/recipes/config/login_nodes_keys.rb +++ b/cookbooks/aws-parallelcluster-environment/recipes/config/login_nodes_keys.rb @@ -21,7 +21,7 @@ script_dir = "#{keys_dir}/scripts" script_path = "#{script_dir}/keys-manager.sh" -sync_file_path = "#{keys_dir}/.login_nodes_keys_sync_file" +sync_file_path = "#{node['cluster']['shared_login_nodes_keys_sync_file']}" case node['cluster']['node_type'] when 'ComputeFleet' diff --git a/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/login_nodes_keys_spec.rb b/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/login_nodes_keys_spec.rb index 5603982d57..10e0fe0279 100644 --- a/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/login_nodes_keys_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/spec/unit/recipes/login_nodes_keys_spec.rb @@ -93,9 +93,9 @@ end cached(:node) { chef_run.node } - it "waits for cluster config version file" do - is_expected.to run_bash("Wait for synchronization file at #{SYNC_FILE} to be written for version #{CLUSTER_CONFIG_VERSION}").with( - code: "[[ \"$(cat #{SYNC_FILE})\" == \"#{CLUSTER_CONFIG_VERSION}\" ]] || exit 1", + it "Wait for sync file to exist" do + is_expected.to run_bash("Wait for synchronization file at #{SYNC_FILE} to exist").with( + code: "[[ -e #{SYNC_FILE} ]] || exit 1", retries: 30, retry_delay: 10, timeout: 5 diff --git a/cookbooks/aws-parallelcluster-shared/libraries/helpers.rb b/cookbooks/aws-parallelcluster-shared/libraries/helpers.rb index 993e2f8a5b..ce3a27532f 100644 --- a/cookbooks/aws-parallelcluster-shared/libraries/helpers.rb +++ b/cookbooks/aws-parallelcluster-shared/libraries/helpers.rb @@ -95,13 +95,12 @@ def write_sync_file(path) end def wait_sync_file(path) - # Wait for a synchronization file to be written for the current cluster config version. + # Wait for a synchronization file to exist. # Synchronization files are used as a synchronization point between cluster nodes # to signal that a group of actions have been completed. - cluster_config_version = node["cluster"]["cluster_config_version"] # Wait for the config version file to contain the current cluster config version. - bash "Wait for synchronization file at #{path} to be written for version #{cluster_config_version}" do - code "[[ \"$(cat #{path})\" == \"#{cluster_config_version}\" ]] || exit 1" + bash "Wait for synchronization file at #{path} to exist" do + code "[[ -e #{path} ]] || exit 1" retries 30 retry_delay 10 timeout 5