[refactor][fix] Move nmcli status list gen to a function

nmcli is only assured to be installed after detect_os is run so move this command to a function so it can run after detect_os
This commit is contained in:
William Wernert
2020-07-02 17:17:46 -04:00
parent 99d490bc06
commit 57bbb02c65
3 changed files with 6 additions and 3 deletions

View File

@@ -1318,6 +1318,11 @@ set_base_heapsizes() {
ls_heapsize ls_heapsize
} }
set_network_dev_status_list() {
readarray -t nmcli_dev_status_list <<< "$(nmcli -t -f DEVICE,STATE -c no dev status)"
export nmcli_dev_status_list
}
set_main_ip() { set_main_ip() {
MAINIP=$(ip route get 1 | awk '{print $7;exit}') MAINIP=$(ip route get 1 | awk '{print $7;exit}')
} }

View File

@@ -109,6 +109,7 @@ export PATH=$PATH:../salt/common/tools/sbin
got_root got_root
detect_os && detect_ec2 detect_os && detect_ec2
set_network_dev_status_list
if [ "$OS" == ubuntu ]; then if [ "$OS" == ubuntu ]; then
update-alternatives --set newt-palette /etc/newt/palette.original >> $setup_log 2>&1 update-alternatives --set newt-palette /etc/newt/palette.original >> $setup_log 2>&1

View File

@@ -44,6 +44,3 @@ export local_salt_dir=/opt/so/saltstack/local
SCRIPTDIR=$(cd "$(dirname "$0")" && pwd) SCRIPTDIR=$(cd "$(dirname "$0")" && pwd)
export SCRIPTDIR export SCRIPTDIR
readarray -t nmcli_dev_status_list <<< "$(nmcli -t -f DEVICE,STATE -c no dev status)"
export nmcli_dev_status_list