[refactor] Set $REDIRECTIT outside of subshell

This commit is contained in:
William Wernert
2020-07-14 09:05:09 -04:00
parent aa4d435020
commit 178ac79da8
2 changed files with 12 additions and 14 deletions

View File

@@ -871,6 +871,17 @@ get_redirect() {
if [ "$REDIRECTINFO" = "OTHER" ]; then
whiptail_set_redirect_host
fi
case $REDIRECTINFO in
'IP')
export REDIRECTIT="$MAINIP"
;;
'HOSTNAME')
export REDIRECTIT="$HOSTNAME"
;;
*)
export REDIRECTIT="$REDIRECTHOST"
;;
esac
}
got_root() {
@@ -938,18 +949,6 @@ manager_pillar() {
" mtu: $MTU" >> "$pillar_file"
fi
case $REDIRECTINFO in
'IP')
export REDIRECTIT="$MAINIP"
;;
'HOSTNAME')
export REDIRECTIT=$HOSTNAME
;;
*)
export REDIRECTIT="$REDIRECTHOST"
;;
esac
printf '%s\n'\
" elastalert: 1"\
" nids_rules: $RULESETUP"\

View File

@@ -378,8 +378,6 @@ if [[ $is_minion ]]; then
copy_ssh_key >> $setup_log 2>&1
fi
# Begin install
{
# Set initial percentage to 0
@@ -633,6 +631,7 @@ else
fi
if [[ -n $ALLOW_ROLE && -n $ALLOW_CIDR ]]; then
echo "Running so-allow -${ALLOW_ROLE} for ${ALLOW_CIDR}"
IP=$ALLOW_CIDR so-allow -$ALLOW_ROLE >> $setup_log 2>&1
fi