@@ -146,7 +146,6 @@ spec:
146146 managedLifecycle: $SHARDED_BACKUP_MANAGED_LIFECYCLE
147147$SHARDED_BACKUP_STATUS_YAML
148148EOF
149- )"
150149 retry kubectl create -f /tmp/backup-to-create -o json > /tmp/created-sharded-backup
151150 SHARDED_BACKUP_UID=" $( jq .metadata.uid /tmp/created-sharded-backup) "
152151 else
@@ -284,7 +283,7 @@ create_backup_restore_point() {
284283 echo " Creating restore point $SHARDED_BACKUP_NAME "
285284 cat << EOF | { set +e; kubectl exec -i -n "$CLUSTER_NAMESPACE " "$( cat /tmp/current-primary) " -c "$PATRONI_CONTAINER_NAME " \
286285 -- sh -e $SHELL_XTRACE 2>&1; printf %s "$? " > /tmp/backup-restore-point-exit-code; } | tee /tmp/backup-restore-point
287- psql -d " $SHARDED_CLUSTER_DATABASE " -v ON_ERROR_STOP=1 \
286+ psql -q - d "$SHARDED_CLUSTER_DATABASE " -v ON_ERROR_STOP=1 \
288287$(
289288 if [ " $SHARDING_TYPE " = citus ]
290289 then
311310 echo " Retrieving latest LSNs"
312311 cat << EOF | { set +e; kubectl exec -i -n "$CLUSTER_NAMESPACE " "$( cat /tmp/current-primary) " -c "$PATRONI_CONTAINER_NAME " \
313312 -- sh -e $SHELL_XTRACE 2>&1; printf %s "$? " > /tmp/backup-restore-point-lsns-exit-code; } | tee /tmp/backup-restore-point-lsns
314- psql -d " $SHARDED_CLUSTER_DATABASE " -t -A -v ON_ERROR_STOP=1 \
313+ psql -q - d "$SHARDED_CLUSTER_DATABASE " -t -A -v ON_ERROR_STOP=1 \
315314$(
316315 if [ " $SHARDING_TYPE " = citus ]
317316 then
340339 echo " Creating checkpoint and rotate the WALs"
341340 cat << EOF | { set +e; kubectl exec -i -n "$CLUSTER_NAMESPACE " "$( cat /tmp/current-primary) " -c "$PATRONI_CONTAINER_NAME " \
342341 -- sh -e $SHELL_XTRACE 2>&1; printf %s "$? " > /tmp/backup-restore-point-checkpoint-exit-code; } | tee /tmp/backup-restore-point-checkpoint
343- psql -d " $SHARDED_CLUSTER_DATABASE " -v ON_ERROR_STOP=1 \
342+ psql -q - d "$SHARDED_CLUSTER_DATABASE " -v ON_ERROR_STOP=1 \
344343$(
345344 if [ " $SHARDING_TYPE " = citus ]
346345 then
378377 do
379378 cat << EOF | { set +e; kubectl exec -i -n "$CLUSTER_NAMESPACE " "$( cat /tmp/current-primary) " -c "$PATRONI_CONTAINER_NAME " \
380379 -- sh -e $SHELL_XTRACE 2>&1; printf %s "$? " > /tmp/backup-restore-point-current-lnss-exit-code; } | tee /tmp/backup-restore-point-current-lnss
381- psql -d " $SHARDED_CLUSTER_DATABASE " -t -A -v ON_ERROR_STOP=1 \
380+ psql -q - d "$SHARDED_CLUSTER_DATABASE " -t -A -v ON_ERROR_STOP=1 \
382381$(
383382 if [ " $SHARDING_TYPE " = citus ]
384383 then
@@ -423,20 +422,22 @@ EOF
423422set_backup_completed () {
424423 cat << EOF | tee /tmp/backup-to-patch
425424[
426- {" op" :" replace" ," path" :" /status/sgBackups" ," value" :['" $( cat /tmp/current-backups \
427- | sed ' s/^\(.*\)$/"\1"/' | tr ' \n' ' ,' | sed ' s/,$//' ) " ']},
425+ {"op":"replace","path":"/status/sgBackups","value":[$(
426+ cat /tmp/current-backups \
427+ | sed ' s/^\(.*\)$/"\1"/' | tr ' \n' ' ,' | sed ' s/,$//'
428+ ) ]},
428429 {"op":"replace","path":"/status/process/failure","value":""},
429430 {"op":"replace","path":"/status/process/timing","value":{
430- " stored" :" ' " $(date_iso8601)" ' " ,
431- " start" :" ' " $(cat /tmp/current-start-time)" ' " ,
432- " end" :" ' " $(cat /tmp/current-end-time)" ' "
431+ "stored":"$( date_iso8601) ",
432+ "start":"$( cat /tmp/current-start-time) ",
433+ "end":"$( cat /tmp/current-end-time) "
433434 }
434435 },
435436 {"op":"replace","path":"/status/backupInformation","value":{
436- " postgresVersion" :" ' " $POSTGRES_VERSION" ' " ,
437+ "postgresVersion":"$POSTGRES_VERSION ",
437438 "size":{
438- " uncompressed" :' " $( cat /tmp/current-uncompressed-size) " ' ,
439- " compressed" :' " $( cat /tmp/current-compressed-size) " '
439+ "uncompressed":$( cat /tmp/current-uncompressed-size) ,
440+ "compressed":$( cat /tmp/current-compressed-size)
440441 }
441442 }
442443 }
0 commit comments