Skip to content

Commit 7eb88fd

Browse files
committed
debug for get object
1 parent 8773d95 commit 7eb88fd

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/splunkconf-cloud-recovery.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,9 @@ exec >> /var/log/splunkconf-cloud-recovery-debug.log 2>&1
278278
# 20251215 update cleanssm timer to rely in unit
279279
# 20260119 up to 10.2.0
280280
# 20260129 switch get_object to sync instead of cp, add variable for rom retry and make it longer and more frequent, add cert upgrade when in upgrade mode
281+
# 20260129 catch rpm return code when trying to redeploy same rpm so we still try to do rest of upgrade (like certificates)
281282

282-
VERSION="20260129c"
283+
VERSION="20260129e"
283284

284285
# dont break script on error as we rely on tests for this
285286
set +e
@@ -379,8 +380,13 @@ get_object () {
379380
gsutil -q cp $orig $dest
380381
else
381382
# try to sync not cp in order to optimize
382-
aws s3 sync $orig $dest --quiet
383+
echo ""before $dest"
384+
ls -l $dest
385+
#aws s3 sync $orig $dest --quiet
386+
aws s3 sync $orig $dest
383387
#aws s3 cp $orig $dest --quiet
388+
echo ""after $dest"
389+
ls -l $dest
384390
fi
385391
else
386392
echo "number of arguments passed to get_object is incorrect ($# instead of 2)\n"
@@ -1923,6 +1929,7 @@ if [ "$MODE" != "upgrade" ]; then
19231929
fi
19241930
fi
19251931
# all cases initial and upgrade
1932+
echo "********** CERTS *********************"
19261933
echo "remote : ${remotepackagedir} : copying certs (install or upgrade) " >> /var/log/splunkconf-cloud-recovery-info.log
19271934
# copy to local
19281935
get_object ${remotepackagedir}/mycerts.tar.gz ${localinstalldir}
@@ -2412,14 +2419,16 @@ else
24122419
COUNT=0
24132420
# we need to repeat in case rpm lock taken as it will fail then later on other failures will occur like not having polkit ....
24142421
# unfortunately if ssm is installed something from ssm configured at start may try install software in // breaking us....
2415-
until [[ $COUNT -gt 50 ]] || [[ $RES -eq 0 ]]
2422+
until [[ $COUNT -gt 50 ]] || [[ $RES -eq 0 ]] || [[ $RES -eq 2 ]]
24162423
do
24172424
# install or upgrade
24182425
rpm -Uvh ${localinstalldir}/${splbinary}
24192426
#rpm -K "${localinstalldir}/${splbinary}" || (echo "ERROR : GPG Check failed, splunk rpm file may be corrupted, please check and relaunch\n";exit 1)
24202427
RES=$?
24212428
((COUNT++))
2422-
if [[ $RES -ne 0 ]]; then
2429+
if [[ $RES -eq 2 ]]; then
2430+
echo "rpm was already installed with this version, nothing to do"
2431+
elif [[ $RES -ne 0 ]]; then
24232432
if [[ $COUNT -gt 50 ]]; then
24242433
df -h
24252434
echo "ERROR : rpm fail after multiple tries, please investigate and relaunch, exiting\n"

0 commit comments

Comments
 (0)