reduce setting ssh commands down to 1 function and 1 function call

This commit is contained in:
m0duspwnens
2021-01-06 08:58:33 -05:00
parent 94fd79cd28
commit 48f81d9ac6
2 changed files with 15 additions and 34 deletions

View File

@@ -1080,37 +1080,6 @@ get_minion_type() {
echo "$minion_type"
}
get_scp_cmd() {
local automated=$1
if [ $automated == yes ]; then
scpcmd='sshpass -p "automation" scp -o StrictHostKeyChecking=no'
else
scpcmd='scp'
fi
}
get_ssh_cmd() {
local automated=$1
if [ $automated == yes ]; then
sshcmd='sshpass -p "automation" ssh -o StrictHostKeyChecking=no'
else
sshcmd='ssh'
fi
}
get_ssh_copy_id_cmd() {
local automated=$1
if [ $automated == yes ]; then
sshcopyidcmd='sshpass -p "automation" ssh-copy-id -o StrictHostKeyChecking=no'
else
sshcopyidcmd='ssh-copy-id'
fi
}
host_pillar() {
local pillar_file="$temp_install_dir"/pillar/minions/"$MINION_ID".sls
@@ -2005,6 +1974,20 @@ set_progress_str() {
"----" >> "$setup_log" 2>&1
}
set_ssh_cmds() {
local automated=$1
if [ $automated == yes ]; then
sshcmd='sshpass -p "automation" ssh -o StrictHostKeyChecking=no'
sshcopyidcmd='sshpass -p "automation" ssh-copy-id -o StrictHostKeyChecking=no'
scpcmd='sshpass -p "automation" scp -o StrictHostKeyChecking=no'
else
sshcmd='ssh'
sshcopyidcmd='ssh-copy-id'
scpcmd='scp'
fi
}
sensor_pillar() {
local pillar_file=$temp_install_dir/pillar/minions/$MINION_ID.sls

View File

@@ -146,9 +146,7 @@ case "$setup_type" in
esac
#set ssh commands that will be used based on if this is an automated test install or not
get_scp_cmd $automated
get_ssh_cmd $automated
get_ssh_copy_id_cmd $automated
set_ssh_cmds $automated
# Allow execution of SO tools during setup
local_sbin="$(pwd)/../salt/common/tools/sbin"