Skip to content

Commit 78a207c

Browse files
author
Daniel Carabas
committed
Fix path in backup.pp and reset pgrepack schema task
1 parent 25c1d4e commit 78a207c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

files/common.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ fail() {
77
# Print a stderr: entry if there were anything printed to stderr
88
if [[ -s $_tmp ]]; then
99
# Hack to try and output valid json by replacing newlines with spaces.
10-
echo "{ \"status\": \"error\", \"message\": \"$1\", \"stderr\": \"$(tr '\n' ' ' <$_tmp)\" }"
10+
$(/usr/bin/which echo) "{ \"status\": \"error\", \"message\": \"$1\", \"stderr\": \"$(tr '\n' ' ' <$_tmp)\" }"
1111
else
12-
echo "{ \"status\": \"error\", \"message\": \"$1\" }"
12+
$(/usr/bin/which echo) "{ \"status\": \"error\", \"message\": \"$1\" }"
1313
fi
1414

1515
exit ${2:-1}
1616
}
1717

1818
success() {
19-
echo "$1"
19+
$(/usr/bin/which echo) "$1"
2020
exit 0
2121
}
2222

manifests/backup.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
# Reset the crontab for pe-postgres if the (databases backed up by default every day) change.
5858
exec { 'reset_pe-postgres_crontab':
59-
path => '/usr/local/bin/:/bin/',
59+
path => '/usr/local/bin/:/bin/:/usr/bin',
6060
command => 'crontab -r -u pe-postgres',
6161
onlyif => 'crontab -l -u pe-postgres',
6262
refreshonly => true,

tasks/reset_pgrepack_schema.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
# Puppet Task Name: reset_pgrepack_schema
44
declare PT__installdir
55
# shellcheck disable=SC1090
66
source "$PT__installdir/pe_databases/files/common.sh"
77

88
#Determine if PE Postgres is available
9-
if puppet resource service pe-postgresql | grep -q running; then
9+
if puppet resource service pe-postgresql | $(/usr/bin/which grep) -q running; then
1010
#Remove the pg_repack extension
1111
su - pe-postgres -s '/bin/bash' -c '/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c "DROP EXTENSION pg_repack CASCADE"' || fail "unable to drop pg_repack extension"
1212

0 commit comments

Comments
 (0)