Move EC2 to more generic cloud verbiage and check for GCP

This commit is contained in:
weslambert
2020-07-08 23:26:48 -04:00
committed by GitHub
parent 67fb46f519
commit ce00d829e1

View File

@@ -505,10 +505,10 @@ configure_network_sensor() {
# Set the MTU # Set the MTU
if [[ $NSMSETUP != 'ADVANCED' ]]; then if [[ $NSMSETUP != 'ADVANCED' ]]; then
if [[ $is_ec2 ]]; then MTU=1575; else MTU=1500; fi if [[ $is_cloud ]]; then MTU=1575; else MTU=1500; fi
fi fi
if [[ $is_ec2 ]]; then if [[ $is_cloud ]]; then
INTERFACE=${BNICS[0]} INTERFACE=${BNICS[0]}
local nmcli_con_arg="type ethernet" local nmcli_con_arg="type ethernet"
else else
@@ -553,7 +553,7 @@ configure_network_sensor() {
ethtool -K "$BNIC" $i off >> "$setup_log" 2>&1 ethtool -K "$BNIC" $i off >> "$setup_log" 2>&1
done done
if [[ $is_ec2 ]]; then if [[ $is_cloud ]]; then
nmcli con up "$BNIC" >> "$setup_log" 2>&1 nmcli con up "$BNIC" >> "$setup_log" 2>&1
else else
# Check if the bond slave connection has already been created # Check if the bond slave connection has already been created
@@ -583,9 +583,9 @@ configure_network_sensor() {
fi fi
} }
detect_ec2() { detect_cloud() {
echo "Testing if setup is running on an EC2 instance" echo "Testing if setup is running on a cloud instance"
if ( curl --fail -s -m 5 http://169.254.169.254/latest/meta-data/instance-id > /dev/null ); then export is_ec2="true"; fi if ( curl --fail -s -m 5 http://169.254.169.254/latest/meta-data/instance-id > /dev/null ) || ( dmidecode -s bios-vendor | grep -q Google); then export is_cloud="true"; fi
} }
detect_os() { detect_os() {