Skip to content

Commit aa7f3fe

Browse files
authored
Merge branch 'release-3.12' into wip/mgiacomo/3120/spec-al23-1212-1
2 parents 0bbd11d + 00f5fec commit aa7f3fe

File tree

7 files changed

+294
-24
lines changed

7 files changed

+294
-24
lines changed

cookbooks/aws-parallelcluster-environment/spec/unit/recipes/isolated_install_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
it 'has the correct content' do
2828
is_expected.to render_file("#{node['cluster']['scripts_dir']}/patch-iso-instance.sh")
29-
.with_content("USERS=(root #{node['cluster']['cluster_admin_user']} #{node['cluster']['cluster_user']})")
29+
.with_content("source /etc/profile.d/aws-cli-default-config.sh")
3030
end
3131
end
3232
end

cookbooks/aws-parallelcluster-environment/templates/isolated/patch-iso-instance.sh.erb

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,41 @@ REGION="$(get_instance_region)"
1919

2020
source /etc/os-release
2121
OS="${ID}${VERSION_ID}"
22-
[[ "${OS}" != "amzn2" ]] && echo "[ERROR] Unsupported OS '${OS}'. Configuration supported only on Amazon Linux 2." && exit 1
22+
23+
if [[ "${OS}" != "amzn2" && "${OS}" != "amzn2023" ]]; then
24+
echo "[ERROR] Unsupported OS '${OS}'. Configuration supported only on Amazon Linux 2 and Amazon Linux 2023."
25+
exit 1
26+
fi
2327

2428
echo "[INFO] Starting: instance configuration for US isolated region"
2529

2630
echo "[INFO] Starting: installation of packages from amazon Linux 2 repository for US isolated region"
2731

28-
REPOSITORY_DEFINITION_FILE="/etc/yum.repos.d/tmp-amzn2-iso.repo"
32+
REPOSITORY_DEFINITION_FILE="/etc/yum.repos.d/tmp-${OS}-iso.repo"
33+
34+
if [[ "${OS}" == "amzn2023" ]]; then
35+
cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION
36+
[amzn2023-iso]
37+
name=Amazon Linux 2023 isolated Region repository
38+
mirrorlist=http://al2023-repos-\$awsregion-de612dc2.s3.\$awsregion.\$awsdomain/core-iso/mirrors/\$releasever/\$basearch/mirror.list
39+
priority=10
40+
enabled=1
41+
repo_gpgcheck=0
42+
type=rpm
43+
gpgcheck=0
44+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023
45+
REPO_DEFINITION
2946

30-
cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION
47+
echo "sslverify=0" >> /etc/dnf/dnf.conf
48+
echo -n "" | sudo tee /etc/dnf/vars/dualstack
49+
if [[ ${REGION} == us-isob* ]]; then
50+
dnf install -y amazon-linux-repo-iso ca-certificates-isob
51+
else
52+
dnf install -y amazon-linux-repo-iso ca-certificates-iso
53+
fi
54+
sed -i "s/sslverify=0//g" /etc/dnf/dnf.conf
55+
else
56+
cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION
3157
[amzn2-iso]
3258
name=Amazon Linux 2 isolated region repository
3359
mirrorlist=http://amazonlinux.\$awsregion.\$awsdomain/\$releasever/core-\$awsregion/latest/\$basearch/mirror.list
@@ -39,30 +65,35 @@ mirrorlist_expire=300
3965
report_instanceid=yes
4066
REPO_DEFINITION
4167

42-
yum --disablerepo="*" --enablerepo="amzn2-iso" install -y "*-${REGION}"
68+
yum --disablerepo="*" --enablerepo="${OS}-iso" install -y "*-${REGION}"
69+
fi
70+
4371
rm -f ${REPOSITORY_DEFINITION_FILE}
4472

45-
echo "[INFO] Complete: installation of packages from amazon Linux 2 repository for US isolated region"
73+
echo "[INFO] Complete: installation of packages from ${OS} repository for US isolated region"
4674

4775
echo "[INFO] Starting: CA bundle configuration for AWS CLI in US isolated region"
4876

49-
USERS=(<%= @users %>)
5077
CA_BUNDLE="/etc/pki/${REGION}/certs/ca-bundle.pem"
5178

52-
for user in "${USERS[@]}"; do
53-
echo "[INFO] Setting CA bundle ${CA_BUNDLE} for user ${user}"
54-
sudo mkhomedir_helper $user
55-
sudo -u $user aws configure set ca_bundle "$CA_BUNDLE"
56-
done
79+
sudo aws configure set ca_bundle "$CA_BUNDLE"
5780

5881
echo "[INFO] Complete: CA bundle configuration for AWS CLI in US isolated region"
5982

6083
echo "[INFO] Starting: Setting system-wide environment variables for AWS CLI in US isolated region"
6184

85+
echo "export AWS_CA_BUNDLE=/etc/pki/${REGION}/certs/ca-bundle.pem" >> /etc/profile.d/aws-cli-default-config.sh
86+
6287
echo "export AWS_DEFAULT_REGION=${REGION}" >> /etc/profile.d/aws-cli-default-config.sh
6388

64-
echo "Defaults env_keep += \"AWS_DEFAULT_REGION AWS_CA_BUNDLE\"" > /etc/sudoers.d/pcluster-aws-cli-envkeep
89+
echo "export REQUESTS_CA_BUNDLE=${AWS_CA_BUNDLE}" >> /etc/profile.d/aws-cli-default-config.sh
6590

66-
echo "[INFO] Complete: Setting system-wide environment variables for AWS CLI in US isolated region"
91+
echo "export SSL_CERT_FILE=${AWS_CA_BUNDLE}" >> /etc/profile.d/aws-cli-default-config.sh
92+
93+
echo "Defaults env_keep += \"AWS_DEFAULT_REGION AWS_CA_BUNDLE REQUESTS_CA_BUNDLE SSL_CERT_FILE\"" > /etc/sudoers.d/pcluster-aws-cli-envkeep
6794

68-
echo "[INFO] Complete: instance configuration for US isolated region"
95+
source /etc/profile.d/aws-cli-default-config.sh
96+
97+
sudo aws configure set ca_bundle "$CA_BUNDLE"
98+
99+
echo "[INFO] Complete: Setting system-wide environment variables for AWS CLI in US isolated region"

cookbooks/aws-parallelcluster-environment/test/controls/isolated_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@
1717
its('owner') { should cmp 'root' }
1818
its('group') { should cmp 'root' }
1919
its('mode') { should cmp '0744' }
20-
its('content') { should match /USERS=\(root #{node['cluster']['cluster_admin_user']} #{node['cluster']['cluster_user']}\)/ }
2120
end
2221
end

cookbooks/aws-parallelcluster-platform/files/ami_cleanup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ rm -f /etc/udev/rules.d/70-persistent-net.rules
99
grep -l "Created by cloud-init on instance boot automatically" /etc/sysconfig/network-scripts/ifcfg-* | xargs rm -f
1010
rm -rf /var/crash/*
1111

12+
if [ -f /opt/parallelcluster/pin_releasesever ]; then
13+
rm -f /opt/parallelcluster/pin_releasesever
14+
rm -f /etc/yum/vars/releasever
15+
fi
16+
1217
# https://bugs.centos.org/view.php?id=13836#c33128
1318
source /etc/os-release
1419
if [ "${ID}${VERSION_ID}" == "centos7" ]; then

cookbooks/aws-parallelcluster-platform/files/isolated/iso-ca-bundle-config.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function get_instance_region {
99

1010
REGION="$(get_instance_region)"
1111

12+
CA_BUNDLE="/etc/pki/${REGION}/certs/ca-bundle.pem"
13+
1214
echo "export AWS_CA_BUNDLE=/etc/pki/${REGION}/certs/ca-bundle.pem" >> /etc/profile.d/aws-cli-default-config.sh
1315

1416
echo "export AWS_DEFAULT_REGION=${REGION}" >> /etc/profile.d/aws-cli-default-config.sh

cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/slurm_dependencies_alinux2023.rb

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
use 'partial/_slurm_dependencies_common'
1616

17+
http_parser_version = "2.9.4"
18+
http_parser_url = "#{node['cluster']['artifacts_s3_url']}/dependencies/http_parser/v#{http_parser_version}.tar.gz"
19+
http_parser_tarball = "#{node['cluster']['sources_dir']}/http-parser-#{http_parser_version}.tar.gz"
20+
1721
def dependencies
1822
%w(json-c-devel perl perl-Switch lua-devel dbus-devel)
1923
end
@@ -22,13 +26,25 @@ def dependencies
2226
# http parser is no longer maintained, therefore Amazon Linux 2023 does have have the package in OS repos
2327
# https://docs.aws.amazon.com/linux/al2023/release-notes/removed-AL2023.4-AL2.html
2428
# Following https://slurm.schedmd.com/related_software.html#jwt for Installing Http-parser
25-
bash 'Install http-parser' do
26-
code <<-HTTP_PARSER
27-
set -e
28-
git clone --depth 1 --single-branch -b v2.9.4 https://github.com/nodejs/http-parser.git http_parser
29-
cd http_parser
30-
make
31-
make install
32-
HTTP_PARSER
29+
30+
remote_file "#{http_parser_tarball}" do
31+
source "#{http_parser_url}"
32+
mode '0644'
33+
retries 3
34+
retry_delay 5
35+
action :create_if_missing
36+
end
37+
38+
bash 'make install' do
39+
user 'root'
40+
group 'root'
41+
cwd "#{node['cluster']['sources_dir']}"
42+
code <<-HTTP
43+
set -e
44+
tar xf #{http_parser_tarball}
45+
cd http-parser-#{http_parser_version}
46+
make
47+
make install
48+
HTTP
3349
end
3450
end
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
#!/bin/bash
2+
set -xe
3+
4+
cd /etc/chef
5+
cat << 'EOF' > support_secondary_network_interface_patch
6+
Subject: [PATCH] Configure proper priority for route tables
7+
Raise priority of ParallelCluster configured route tables (#2857)
8+
Support attaching multiple network interfaces to the same network card
9+
---
10+
Index: cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh
11+
<+>UTF-8
12+
===================================================================
13+
diff --git a/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh
14+
--- a/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh (revision 9fe7e20db84ca556bcb830210c1f9ea852a38a89)
15+
+++ b/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh (revision e3949f39db1248a6a373283dc6132ac2edff1ff9)
16+
@@ -4,7 +4,8 @@
17+
18+
if
19+
[ -z "${DEVICE_NAME}" ] || # name of the device
20+
- [ -z "${DEVICE_NUMBER}" ] || # number of the device
21+
+ [ -z "${DEVICE_NUMBER}" ] || # index of the device
22+
+ [ -z "${NETWORK_CARD_INDEX}" ] || # index of the network card
23+
[ -z "${DEVICE_IP_ADDRESS}" ] || # ip of the device
24+
[ -z "${MAC}" ] || # mac address of the device
25+
[ -z "${CIDR_BLOCK}" ] # CIDR block of the subnet
26+
@@ -12,7 +13,7 @@
27+
echo 'One or more environment variables missing'
28+
exit 1
29+
fi
30+
-echo "Configuring NIC, Device name: ${DEVICE_NAME}, Device number: ${DEVICE_NUMBER}"
31+
+echo "Configuring NIC, Device name: ${DEVICE_NAME}, Device number: ${DEVICE_NUMBER}, Network card index:${NETWORK_CARD_INDEX}"
32+
33+
configuration_directory="/etc/systemd/network"
34+
file_name="70-${DEVICE_NAME}.network"
35+
@@ -23,12 +24,13 @@
36+
37+
cd "$configuration_directory"
38+
39+
-ROUTE_TABLE=100${DEVICE_NUMBER}
40+
+SUFFIX=$NETWORK_CARD_INDEX$(printf "%02d" $DEVICE_NUMBER)
41+
+ROUTE_TABLE="$(( $SUFFIX + 1000 ))"
42+
43+
ln -s /usr/lib/systemd/network/80-ec2.network ${file_name} # Use default EC2 configuration. This include MTU, etc.
44+
45+
/bin/cat <<EOF > ${sub_directory}/eni.conf
46+
-# Configuration for ${DEVICE_NUMBER} generated by ParallelCluster
47+
+# Configuration for network card: ${NETWORK_CARD_INDEX}, device number: ${DEVICE_NUMBER} generated by ParallelCluster
48+
# This is inspired by https://github.com/amazonlinux/amazon-ec2-net-utils/blob/v2.4.1/lib/lib.sh
49+
[Match]
50+
MACAddress=${MAC}
51+
Index: cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh
52+
IDEA additional info:
53+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
54+
<+>UTF-8
55+
===================================================================
56+
diff --git a/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh
57+
--- a/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh (revision 9fe7e20db84ca556bcb830210c1f9ea852a38a89)
58+
+++ b/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh (revision e3949f39db1248a6a373283dc6132ac2edff1ff9)
59+
@@ -10,7 +10,8 @@
60+
61+
if
62+
[ -z "${DEVICE_NAME}" ] || # name of the device
63+
- [ -z "${DEVICE_NUMBER}" ] || # number of the device
64+
+ [ -z "${DEVICE_NUMBER}" ] || # index of the device
65+
+ [ -z "${NETWORK_CARD_INDEX}" ] || # index of the network card
66+
[ -z "${GW_IP_ADDRESS}" ] || # gateway ip address
67+
[ -z "${DEVICE_IP_ADDRESS}" ] || # ip address to assign to the interface
68+
[ -z "${CIDR_PREFIX_LENGTH}" ] || # the prefix length of the device IP cidr block
69+
@@ -20,9 +21,11 @@
70+
exit 1
71+
fi
72+
73+
-ROUTE_TABLE="100${DEVICE_NUMBER}"
74+
+SUFFIX=$NETWORK_CARD_INDEX$(printf "%02d" $DEVICE_NUMBER)
75+
76+
-echo "Configuring ${DEVICE_NAME} with IP:${DEVICE_IP_ADDRESS} CIDR_PREFIX:${CIDR_PREFIX_LENGTH} NETMASK:${NETMASK} GW:${GW_IP_ADDRESS} ROUTING_TABLE:${ROUTE_TABLE}"
77+
+ROUTE_TABLE="$(( $SUFFIX + 1000 ))"
78+
+
79+
+echo "Configuring device name: ${DEVICE_NAME} with IP:${DEVICE_IP_ADDRESS} CIDR_PREFIX:${CIDR_PREFIX_LENGTH} NETMASK:${NETMASK} GW:${GW_IP_ADDRESS} ROUTING_TABLE:${ROUTE_TABLE}"
80+
81+
# config file
82+
FILE="/etc/sysconfig/network-scripts/ifcfg-${DEVICE_NAME}"
83+
Index: cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh
84+
IDEA additional info:
85+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
86+
<+>UTF-8
87+
===================================================================
88+
diff --git a/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh
89+
--- a/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh (revision 9fe7e20db84ca556bcb830210c1f9ea852a38a89)
90+
+++ b/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh (revision e3949f39db1248a6a373283dc6132ac2edff1ff9)
91+
@@ -13,7 +13,8 @@
92+
93+
if
94+
[ -z "${DEVICE_NAME}" ] || # name of the device
95+
- [ -z "${DEVICE_NUMBER}" ] || # number of the device
96+
+ [ -z "${DEVICE_NUMBER}" ] || # index of the device
97+
+ [ -z "${NETWORK_CARD_INDEX}" ] || # index of the network card
98+
[ -z "${GW_IP_ADDRESS}" ] || # gateway ip address
99+
[ -z "${DEVICE_IP_ADDRESS}" ] || # ip address to assign to the interface
100+
[ -z "${CIDR_PREFIX_LENGTH}" ] # the prefix length of the device IP cidr block
101+
@@ -23,9 +24,10 @@
102+
fi
103+
104+
con_name="System ${DEVICE_NAME}"
105+
-route_table="100${DEVICE_NUMBER}"
106+
-priority="100${DEVICE_NUMBER}"
107+
-metric="100${DEVICE_NUMBER}"
108+
+SUFFIX=$NETWORK_CARD_INDEX$(printf "%02d" $DEVICE_NUMBER)
109+
+route_table="$(( $SUFFIX + 1000 ))"
110+
+priority="${route_table}"
111+
+metric="${route_table}"
112+
113+
# Rename connection
114+
original_con_name=`nmcli -t -f GENERAL.CONNECTION device show ${DEVICE_NAME} | cut -f2 -d':'`
115+
Index: cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh
116+
IDEA additional info:
117+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
118+
<+>UTF-8
119+
===================================================================
120+
diff --git a/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh
121+
--- a/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh (revision 9fe7e20db84ca556bcb830210c1f9ea852a38a89)
122+
+++ b/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh (revision e3949f39db1248a6a373283dc6132ac2edff1ff9)
123+
@@ -13,7 +13,8 @@
124+
125+
if
126+
[ -z "${DEVICE_NAME}" ] || # name of the device
127+
- [ -z "${DEVICE_NUMBER}" ] || # number of the device
128+
+ [ -z "${DEVICE_NUMBER}" ] || # index of the device
129+
+ [ -z "${NETWORK_CARD_INDEX}" ] || # index of the network card
130+
[ -z "${GW_IP_ADDRESS}" ] || # gateway ip address
131+
[ -z "${DEVICE_IP_ADDRESS}" ] || # ip address to assign to the interface
132+
[ -z "${CIDR_PREFIX_LENGTH}" ] # the prefix length of the device IP cidr block
133+
@@ -23,9 +24,10 @@
134+
fi
135+
136+
con_name="System ${DEVICE_NAME}"
137+
-route_table="100${DEVICE_NUMBER}"
138+
-priority="100${DEVICE_NUMBER}"
139+
-metric="100${DEVICE_NUMBER}"
140+
+SUFFIX=$NETWORK_CARD_INDEX$(printf "%02d" $DEVICE_NUMBER)
141+
+route_table="$(( $SUFFIX + 1000 ))"
142+
+priority="${route_table}"
143+
+metric="${route_table}"
144+
145+
# Rename connection
146+
original_con_name=`nmcli -t -f GENERAL.CONNECTION device show ${DEVICE_NAME} | cut -f2 -d':'`
147+
Index: cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh
148+
IDEA additional info:
149+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
150+
<+>UTF-8
151+
===================================================================
152+
diff --git a/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh
153+
--- a/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh (revision 9fe7e20db84ca556bcb830210c1f9ea852a38a89)
154+
+++ b/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh (revision e3949f39db1248a6a373283dc6132ac2edff1ff9)
155+
@@ -10,7 +10,8 @@
156+
157+
if
158+
[ -z "${DEVICE_NAME}" ] || # name of the device
159+
- [ -z "${DEVICE_NUMBER}" ] || # number of the device
160+
+ [ -z "${DEVICE_NUMBER}" ] || # index of the device
161+
+ [ -z "${NETWORK_CARD_INDEX}" ] || # index of the network card
162+
[ -z "${GW_IP_ADDRESS}" ] || # gateway ip address
163+
[ -z "${DEVICE_IP_ADDRESS}" ] || # ip address to assign to the interface
164+
[ -z "${CIDR_PREFIX_LENGTH}" ] || # the prefix length of the device IP cidr block
165+
@@ -40,7 +41,8 @@
166+
fi
167+
168+
FILE="/etc/netplan/${DEVICE_NAME}.yaml"
169+
-ROUTE_TABLE="100${DEVICE_NUMBER}"
170+
+SUFFIX=$NETWORK_CARD_INDEX$(printf "%02d" $DEVICE_NUMBER)
171+
+ROUTE_TABLE="$(( $SUFFIX + 1000 ))"
172+
173+
echo "Configuring ${DEVICE_NAME} with IP:${DEVICE_IP_ADDRESS} CIDR_PREFIX:${CIDR_PREFIX_LENGTH} NETMASK:${NETMASK} GW:${GW_IP_ADDRESS} ROUTING_TABLE:${ROUTE_TABLE}"
174+
175+
Index: cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb
176+
IDEA additional info:
177+
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
178+
<+>UTF-8
179+
===================================================================
180+
diff --git a/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb b/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb
181+
--- a/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb (revision 9fe7e20db84ca556bcb830210c1f9ea852a38a89)
182+
+++ b/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb (revision cb83f4c721ead74d826b433e285eac80b88ad6dc)
183+
@@ -16,7 +16,13 @@
184+
return if on_docker?
185+
186+
def network_card_index(mac, token)
187+
+ # This IMDS call is not available on single NIC instance, therefore fallback to 0
188+
uri = URI("http://169.254.169.254/latest/meta-data/network/interfaces/macs/#{mac}/network-card")
189+
+ get_metadata_with_token(token, uri) || 0
190+
+end
191+
+
192+
+def device_number(mac, token)
193+
+ uri = URI("http://169.254.169.254/latest/meta-data/network/interfaces/macs/#{mac}/device-number")
194+
get_metadata_with_token(token, uri)
195+
end
196+
197+
@@ -69,6 +75,7 @@
198+
# Configure nw interfaces
199+
macs.each do |mac|
200+
device_name = device_name(mac)
201+
+ device_number = device_number(mac, token)
202+
network_card_index = network_card_index(mac, token)
203+
gw_ip_address = gateway_address
204+
device_ip_address = device_ip(mac, token)
205+
@@ -84,7 +91,8 @@
206+
environment(
207+
# TODO: The variables are a superset of what's required by individual scripts. Consider simplification.
208+
'DEVICE_NAME' => device_name,
209+
- 'DEVICE_NUMBER' => "#{network_card_index}", # in configure_nw_interface DEVICE_NUMBER actually means network card index
210+
+ 'DEVICE_NUMBER' => "#{device_number}",
211+
+ 'NETWORK_CARD_INDEX' => "#{network_card_index}",
212+
'GW_IP_ADDRESS' => gw_ip_address,
213+
'DEVICE_IP_ADDRESS' => device_ip_address,
214+
'CIDR_PREFIX_LENGTH' => cidr_prefix_length,
215+
EOF
216+
217+
git apply support_secondary_network_interface_patch

0 commit comments

Comments
 (0)