Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(SUP-2372) add pg_repack schema reset task #53

Merged
merged 5 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tasks/reset_pgrepack_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"puppet_task_version": 1,
"supports_noop": false,
"description": "This task will remove and recreate the pg_repack extension"
}
16 changes: 16 additions & 0 deletions tasks/reset_pgrepack_schema.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# Puppet Task Name: reset_pgrepack_schema

#Determine if PE Postgres is available
if puppet resource service pe-postgresql | grep -q running; then
#Remove the pg_repack extension
su - pe-postgres -s '/bin/bash' -c '/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c "DROP EXTENSION pg_repack CASCADE"'

#Then, recreate the pg_repack extension
su - pe-postgres -s '/bin/bash' -c '/opt/puppetlabs/server/bin/psql -d pe-puppetdb -c "CREATE EXTENSION pg_repack"'
else
echo " -- No running PE-PostgreSQL instance found, please run this task against your Primary or PE-PostgreSQL server --"
fi

echo " -- reset_pgrepack_scheme Task ended: $(date +%s) --"