Skip to content

Commit 2940239

Browse files
Himani Anil Deshpandehimani2411
authored andcommitted
[Bug] Install cookbook dependencies in all regions
1 parent cd19693 commit 2940239

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

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

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
virtualenv_path = cookbook_virtualenv_path
1515
dependency_package_name = "pypi-cookbook-dependencies-#{node['cluster']['python-major-minor-version']}-#{node['kernel']['machine']}"
16-
pypi_s3_uri = "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{dependency_package_name}.tgz"
16+
pypi_s3_uri = "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/#{dependency_package_name}.tgz"
1717
if platform?('amazon') && node['platform_version'] == "2"
1818
dependency_package_name = "dependencies"
1919
pypi_s3_uri = "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/cookbook-dependencies.tgz"
@@ -33,24 +33,22 @@
3333
not_if { ::File.exist?("#{cookbook_virtualenv_path}/bin/activate") }
3434
end
3535

36-
if aws_region.start_with?("us-iso")
37-
remote_file "#{node['cluster']['base_dir']}/cookbook-dependencies.tgz" do
38-
source pypi_s3_uri
39-
mode '0644'
40-
retries 3
41-
retry_delay 5
42-
action :create_if_missing
43-
end
36+
remote_file "#{node['cluster']['base_dir']}/cookbook-dependencies.tgz" do
37+
source pypi_s3_uri
38+
mode '0644'
39+
retries 3
40+
retry_delay 5
41+
action :create_if_missing
42+
end
4443

45-
bash 'pip install' do
46-
user 'root'
47-
group 'root'
48-
cwd "#{node['cluster']['base_dir']}"
49-
code <<-REQ
50-
set -e
51-
tar xzf cookbook-dependencies.tgz
52-
cd #{dependency_package_name}
53-
#{virtualenv_path}/bin/pip install * -f ./ --no-index
54-
REQ
55-
end
44+
bash 'pip install' do
45+
user 'root'
46+
group 'root'
47+
cwd "#{node['cluster']['base_dir']}"
48+
code <<-REQ
49+
set -e
50+
tar xzf cookbook-dependencies.tgz
51+
cd #{dependency_package_name}
52+
#{virtualenv_path}/bin/pip install * -f ./ --no-index
53+
REQ
5654
end

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
cached(:python_version) { 'python_version' }
77
cached(:system_pyenv_root) { 'system_pyenv_root' }
88
cached(:virtualenv_path) { 'system_pyenv_root/versions/python_version/envs/cookbook_virtualenv' }
9-
cached(:aws_region) { 'us-iso-test' }
9+
cached(:aws_region) { 'any-region' }
1010

1111
context "when cookbook virtualenv not installed yet" do
1212
cached(:chef_run) do
@@ -35,14 +35,12 @@
3535
expect(node.default['cluster']['cookbook_virtualenv_path']).to eq(virtualenv_path)
3636
is_expected.to write_node_attributes('dump node attributes')
3737
end
38-
context "when in isolated region" do
39-
it 'installs python packages' do
40-
is_expected.to run_bash("pip install").with(
41-
user: 'root',
42-
group: 'root',
43-
cwd: "#{node['cluster']['base_dir']}"
44-
).with_code(/tar xzf cookbook-dependencies.tgz/)
45-
end
38+
it 'installs python packages' do
39+
is_expected.to run_bash("pip install").with(
40+
user: 'root',
41+
group: 'root',
42+
cwd: "#{node['cluster']['base_dir']}"
43+
).with_code(/tar xzf cookbook-dependencies.tgz/)
4644
end
4745
end
4846
end

0 commit comments

Comments
 (0)