From ce00d829e15595a35a9d711a6f4e8e462d0aa5e8 Mon Sep 17 00:00:00 2001 From: weslambert Date: Wed, 8 Jul 2020 23:26:48 -0400 Subject: [PATCH 1/3] Move EC2 to more generic cloud verbiage and check for GCP --- setup/so-functions | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index d2915f4ff..0b6f99142 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -505,10 +505,10 @@ configure_network_sensor() { # Set the MTU 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 - if [[ $is_ec2 ]]; then + if [[ $is_cloud ]]; then INTERFACE=${BNICS[0]} local nmcli_con_arg="type ethernet" else @@ -553,7 +553,7 @@ configure_network_sensor() { ethtool -K "$BNIC" $i off >> "$setup_log" 2>&1 done - if [[ $is_ec2 ]]; then + if [[ $is_cloud ]]; then nmcli con up "$BNIC" >> "$setup_log" 2>&1 else # Check if the bond slave connection has already been created @@ -583,9 +583,9 @@ configure_network_sensor() { fi } -detect_ec2() { - echo "Testing if setup is running on an EC2 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 +detect_cloud() { + 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 ) || ( dmidecode -s bios-vendor | grep -q Google); then export is_cloud="true"; fi } detect_os() { From 889ba67d85ad5bd26102c52977907acfc4e5b40a Mon Sep 17 00:00:00 2001 From: weslambert Date: Wed, 8 Jul 2020 23:27:46 -0400 Subject: [PATCH 2/3] Move EC2 to more generic cloud verbiage --- setup/so-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/so-setup b/setup/so-setup index b6ef14c3a..3f6d42380 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -109,7 +109,7 @@ export PATH=$PATH:../salt/common/tools/sbin got_root -detect_os && detect_ec2 +detect_os && detect_cloud set_network_dev_status_list if [ "$OS" == ubuntu ]; then From c01047fad21ff2e679ac6ae86f32cd3eb5922c33 Mon Sep 17 00:00:00 2001 From: weslambert Date: Wed, 8 Jul 2020 23:30:50 -0400 Subject: [PATCH 3/3] Add /dev/null --- setup/so-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/so-functions b/setup/so-functions index 0b6f99142..5bbb319eb 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -585,7 +585,7 @@ configure_network_sensor() { detect_cloud() { 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 ) || ( dmidecode -s bios-vendor | grep -q Google); then export is_cloud="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 > /dev/null); then export is_cloud="true"; fi } detect_os() {