diff --git a/sdcm/provision/aws/configuration_script.py b/sdcm/provision/aws/configuration_script.py index 88a72dd1b9..81c449d1c4 100644 --- a/sdcm/provision/aws/configuration_script.py +++ b/sdcm/provision/aws/configuration_script.py @@ -11,7 +11,7 @@ # # Copyright (c) 2021 ScyllaDB -from sdcm.provision.aws.utils import network_config_ipv6_workaround_script, configure_eth1_script +from sdcm.provision.aws.utils import network_config_ipv6_workaround_script from sdcm.provision.common.configuration_script import ConfigurationScriptBuilder @@ -27,8 +27,6 @@ def _wait_before_running_script(self) -> str: def _script_body(self) -> str: script = super()._script_body() - if self.aws_additional_interface: - script += configure_eth1_script() if self.aws_ipv6_workaround: script += network_config_ipv6_workaround_script() return script diff --git a/sdcm/provision/aws/utils.py b/sdcm/provision/aws/utils.py index de002bff47..f3f6ac52d3 100644 --- a/sdcm/provision/aws/utils.py +++ b/sdcm/provision/aws/utils.py @@ -283,80 +283,6 @@ def network_config_ipv6_workaround_script(): """) -def configure_eth1_script(): - return dedent(r""" - if grep -qi "ubuntu" /etc/os-release; then - - ETH1_IP_ADDRESS=`ip route show | grep eth1 | grep -oPm1 'src \K[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*'` - ETH1_CIDR_BLOCK=`ip route show | grep eth1 | grep -oPm1 '\K[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/[0-9]*'` - ETH1_SUBNET=`echo ${ETH1_CIDR_BLOCK} | grep -oP '\\K/\\d+'` - - bash -c "echo ' - network: - version: 2 - renderer: networkd - ethernets: - eth0: - dhcp4: yes - dhcp6: yes - eth1: - addresses: - - ${ETH1_IP_ADDRESS}${ETH1_SUBNET} - dhcp4: no - dhcp6: no - routes: - - to: 0.0.0.0/0 - via: 10.0.0.1 # Default gateway - table: 2 - - to: ${ETH1_CIDR_BLOCK} - scope: link - table: 2 - routing-policy: - - from: ${ETH1_IP_ADDRESS}/32 - table: 2 - ' > /etc/netplan/51-eth1.yaml" - - netplan --debug apply - - else - TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 600") - BASE_EC2_NETWORK_URL=http://169.254.169.254/latest/meta-data/network/interfaces/macs/ - NUMBER_OF_ENI=`curl -s -H "X-aws-ec2-metadata-token: ${TOKEN}" ${BASE_EC2_NETWORK_URL} | wc -w` - for mac in `curl -s -H "X-aws-ec2-metadata-token: ${TOKEN}" ${BASE_EC2_NETWORK_URL}` - do - DEVICE_NUMBER=`curl -s -H "X-aws-ec2-metadata-token: ${TOKEN}" ${BASE_EC2_NETWORK_URL}${mac}/device-number` - if [[ "$DEVICE_NUMBER" == "1" ]]; then - ETH1_MAC=${mac} - fi - done - if [[ ! "${DEVICE_NUMBER}x" == "x" ]]; then - ETH1_IP_ADDRESS=`curl -s -H "X-aws-ec2-metadata-token: ${TOKEN}" ${BASE_EC2_NETWORK_URL}${ETH1_MAC}/local-ipv4s` - ETH1_CIDR_BLOCK=`curl -s -H "X-aws-ec2-metadata-token: ${TOKEN}" ${BASE_EC2_NETWORK_URL}${ETH1_MAC}/subnet-ipv4-cidr-block` - fi - bash -c "echo 'GATEWAYDEV=eth0' >> /etc/sysconfig/network" - echo " - DEVICE="eth1" - BOOTPROTO="dhcp" - ONBOOT="yes" - TYPE="Ethernet" - USERCTL="yes" - PEERDNS="yes" - IPV6INIT="no" - PERSISTENT_DHCLIENT="1" - " > /etc/sysconfig/network-scripts/ifcfg-eth1 - echo " - default via 10.0.0.1 dev eth1 table 2 - ${ETH1_CIDR_BLOCK} dev eth1 src ${ETH1_IP_ADDRESS} table 2 - " > /etc/sysconfig/network-scripts/route-eth1 - echo " - from ${ETH1_IP_ADDRESS}/32 table 2 - " > /etc/sysconfig/network-scripts/rule-eth1 - systemctl restart network - - fi - """) - - def configure_set_preserve_hostname_script(): return 'grep "preserve_hostname: true" /etc/cloud/cloud.cfg 1>/dev/null 2>&1 ' \ '|| echo "preserve_hostname: true" >> /etc/cloud/cloud.cfg\n'