Add logging for cloud detection and interface settings

This commit is contained in:
Wes
2023-03-30 16:15:41 +00:00
parent 3cd1598067
commit dfd3456343

View File

@@ -802,9 +802,11 @@ compare_main_nic_ip() {
configure_network_sensor() {
info "Setting up sensor interface"
if [[ $is_cloud ]]; then
if [[ $is_cloud ]]; then
info "Configuring traditional interface settings, since this is a cloud installation..."
local nmcli_con_args=( "type" "ethernet" )
else
info "Configuring bond interface settings, since this is a not a cloud installation..."
local nmcli_con_args=( "type" "bond" "mode" "0" )
fi
@@ -909,7 +911,7 @@ create_repo() {
detect_cloud() {
info "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 > /dev/null) || [ -f /var/log/waagent.log ]; 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) || [ -f /var/log/waagent.log ]; then info "Detected a cloud installation..." && export is_cloud="true"; fi
}
detect_os() {
@@ -1247,11 +1249,12 @@ generate_interface_vars() {
export MTU
# Set interface variable
if [[ $is_cloud ]]; then
if [[ $is_cloud ]]; then
INTERFACE=${BNICS[0]}
else
INTERFACE='bond0'
fi
info "Interface set to $INTERFACE"
export INTERFACE
}