Skip to content

Commit e6ed15f

Browse files
author
Himani Anil Deshpande
committed
[Isolated] Install Pypi dependencies for boto3 and cfn-bootstrap scripts
1 parent 8788fff commit e6ed15f

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

cookbooks/aws-parallelcluster-computefleet/recipes/install/custom_parallelcluster_node.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,27 @@
1919

2020
# TODO: once the pyenv Chef resource supports installing packages from a path (e.g. `pip install .`), convert the
2121
# bash block to a recipe that uses the pyenv resource.
22+
if aws_region.start_with?("us-iso") && platform?('amazon') && node['platform_version'] == "2"
23+
remote_file "#{node['cluster']['base_dir']}/node-dependencies.tgz" do
24+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/node-dependencies.tgz"
25+
mode '0644'
26+
retries 3
27+
retry_delay 5
28+
action :create_if_missing
29+
end
30+
31+
bash 'pip install' do
32+
user 'root'
33+
group 'root'
34+
cwd "#{node['cluster']['base_dir']}"
35+
code <<-REQ
36+
set -e
37+
tar xzf node-dependencies.tgz
38+
cd node
39+
#{node_virtualenv_path}/bin/pip install * -f ./ --no-index
40+
REQ
41+
end
42+
end
2243

2344
bash "install custom aws-parallelcluster-node" do
2445
cwd Chef::Config[:file_cache_path]

cookbooks/aws-parallelcluster-environment/recipes/install/cfn_bootstrap.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,28 @@
3333
not_if { ::File.exist?("#{virtualenv_path}/bin/activate") }
3434
end
3535

36+
if aws_region.start_with?("us-iso")
37+
remote_file "#{node['cluster']['base_dir']}/cfn-dependencies.tgz" do
38+
source "#{node['cluster']['artifacts_s3_url']}/dependencies/PyPi/#{node['kernel']['machine']}/cfn-dependencies.tgz"
39+
mode '0644'
40+
retries 3
41+
retry_delay 5
42+
action :create_if_missing
43+
end
44+
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 cfn-dependencies.tgz
52+
cd cfn
53+
#{virtualenv_path}/bin/pip install * -f ./ --no-index
54+
REQ
55+
end
56+
end
57+
3658
cfnbootstrap_version = '2.0-33'
3759
cfnbootstrap_package = "aws-cfn-bootstrap-py3-#{cfnbootstrap_version}.tar.gz"
3860

0 commit comments

Comments
 (0)