Add test to ensure that directories are not empty

The scp command will fail if the directory in the preceeding for
loop is empty.  This adds a test to ensure that $i is acutally a
file name.

Change-Id: Ib2a3c929a7a15b290c2cf09c05d4079a1ec8c6e6
Closes-Bug: #1621160
This commit is contained in:
Dave Wilde 2016-09-07 11:15:07 -05:00 committed by Kevin Carter (cloudnull)
parent 2309683438
commit 3d3a8c0d5d

View File

@ -58,7 +58,9 @@ done
for node in $(get_all_hosts); do for node in $(get_all_hosts); do
ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mkdir -p /tmp/keys" ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mkdir -p /tmp/keys"
for i in /etc/apt/apt.conf.d/00-nokey /etc/apt/sources.list /etc/apt/sources.list.d/* /tmp/keys/*; do for i in /etc/apt/apt.conf.d/00-nokey /etc/apt/sources.list /etc/apt/sources.list.d/* /tmp/keys/*; do
scp "$i" "10.0.0.${node#*":"}:$i" if [[ -f "$i" ]]; then
scp "$i" "10.0.0.${node#*":"}:$i"
fi
done done
ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "(for i in /tmp/keys/*; do \ ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "(for i in /tmp/keys/*; do \
apt-key add \$i; \ apt-key add \$i; \