diff --git a/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/pcluster.sh.erb b/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/pcluster.sh.erb index 0f23d9c482..f9e2309c61 100644 --- a/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/pcluster.sh.erb +++ b/cookbooks/aws-parallelcluster-environment/templates/cfn_bootstrap/pcluster.sh.erb @@ -2,7 +2,6 @@ # pcluster.sh: # Setup ParallelCluster environment variables # - -PATH=$PATH:<%= @cfn_bootstrap_virtualenv_path %>/bin +PATH=<%= @cfn_bootstrap_virtualenv_path %>/bin:$PATH export PATH diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/cfn_bootstrap_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/cfn_bootstrap_spec.rb index d48629c3d5..20a83960d1 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/cfn_bootstrap_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/cfn_bootstrap_spec.rb @@ -36,6 +36,12 @@ its('mode') { should cmp '0644' } its('owner') { should eq 'root' } its('group') { should eq 'root' } - its('content') { should match "PATH=\\$PATH:#{pyenv_dir}/versions/#{cfn_python_version}/envs/cfn_bootstrap_virtualenv/bin" } + its('content') { should match "PATH=#{pyenv_dir}/versions/#{cfn_python_version}/envs/cfn_bootstrap_virtualenv/bin:\\$PATH" } end + + desc "cfn-init needs to be from the cfnbootstrap virtualenv" + describe bash("sudo -u #{node['cluster']['cluster_user']} -i which cfn-init") do + its('exit_status') { should eq(0) } + its('stdout') { should match("#{pyenv_dir}/versions/#{cfn_python_version}/envs/cfn_bootstrap_virtualenv/bin/cfn-init") } + end unless os_properties.on_docker? end