Skip to content

Commit

Permalink
remove the echo from the run hook
Browse files Browse the repository at this point in the history
Signed-off-by: punitmundra <pmundra@progress.com>
  • Loading branch information
punitmundra committed Nov 30, 2023
1 parent b808165 commit db13942
Show file tree
Hide file tree
Showing 25 changed files with 0 additions and 76 deletions.
3 changes: 0 additions & 3 deletions components/applications-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ exec 2>&1
# We do this here because init hooks block the hab supervisor
DBNAME="{{cfg.storage.database}}"
if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "pgcrypto"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# cleanup old migration files
Expand Down
3 changes: 0 additions & 3 deletions components/authn-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "{{cfg.storage.database}}"

pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/authz-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "{{cfg.storage.database}}"

pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
pg-helper create-extension "{{cfg.storage.database}}" "uuid-ossp"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi
# cleanup old migration files
rm -rf {{pkg.svc_static_path}}/{migrations,data-migrations}
Expand Down
3 changes: 0 additions & 3 deletions components/automate-builder-api/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ render-template config.toml "{{pkg.svc_var_path}}/etc/config.toml" \
export DBNAME="{{cfg.datastore.database}}"
export USERNAME="{{cfg.datastore.user}}"
if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME"
pg-helper fix-permissions "$USERNAME"
pg-helper alter-role --superuser=true "$USERNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

if ! ls {{pkg.svc_data_path}}/keys/bldr-*; then
Expand Down
3 changes: 0 additions & 3 deletions components/automate-cs-bookshelf/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ mkdir -p "{{pkg.svc_var_path}}/etc"
render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper rename-if-exists bookshelf "$DBNAME"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "uuid-ossp"
pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/bookshelf"}}/schema"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/automate-cs-oc-bifrost/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ mkdir -p "{{pkg.svc_var_path}}/etc"
render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper rename-if-exists bifrost "$DBNAME"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "uuid-ossp"
pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/oc_bifrost"}}/schema/"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/automate-cs-oc-erchef/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config"
render-template pg.env "{{pkg.svc_var_path}}/etc/pg.env"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command"
pg-helper rename-if-exists opscode_chef "$DBNAME"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "uuid-ossp"
pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/oc_erchef"}}/schema/baseline"
pg-helper sqitch-deploy "$DBNAME" "{{pkgPathFor "chef/oc_erchef"}}/schema/"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# chef_server_data_bootstrap relies on the webui keys so create that first
Expand Down
3 changes: 0 additions & 3 deletions components/automate-cs-ocid/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ export DBNAME="{{cfg.sql.db_name}}"
mkdir -p "{{pkg.svc_var_path}}/etc"
render-template pg.env "{{pkg.svc_var_path}}/etc/pg.env"
if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper rename-if-exists oc_id "$DBNAME"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "uuid-ossp"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

source "{{pkg.svc_var_path}}/etc/pg.env"
Expand Down
3 changes: 0 additions & 3 deletions components/automate-dex/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ mkdir -p {{pkg.svc_var_path}}/etc
render-template config.yml {{pkg.svc_var_path}}/etc/config.yml --conf {{pkg.svc_config_path}}/config.json

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "{{cfg.storage.database}}"
pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/automate-workflow-server/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ fi
mkdir -p "{{pkg.svc_var_path}}/etc"
render-template sqerl.config "{{pkg.svc_var_path}}/etc/sqerl.config"
if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper migrate-tables delivery "$DBNAME" "$DBUSER"
pg-helper ensure-service-database "$DBNAME" "$DBUSER"

Expand All @@ -94,8 +93,6 @@ if [ ! -f /hab/.skip_migration ]; then
pg-helper create-extension "$DBNAME" "uuid-ossp"
pg-helper sqitch-deploy "$DBNAME" "{{pkg.path}}/schema"
pg-helper fix-permissions "$DBNAME" "$DBUSER"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/cereal-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ exec 2>&1
# Call the script to block until user accepts the MLSA via the package's config
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}
if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "chef_cereal_service"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
4 changes: 0 additions & 4 deletions components/compliance-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export DBNAME="{{cfg.storage.database}}"
export DBUSER="{{cfg.storage.user}}"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
# Migrate from A1's delivery database if it's present
pg-helper migrate-tables-v2 delivery "$DBNAME" \
agents node_managers results profiles tags jobs jobs_nodes jobs_profiles \
Expand All @@ -32,9 +31,6 @@ if [ ! -f /hab/.skip_migration ]; then
pg-helper create-extension "$DBNAME" pgcrypto

pg-helper fix-permissions "$DBNAME"
else

echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

mkdir -p "{{pkg.svc_data_path}}/profiles"
Expand Down
3 changes: 0 additions & 3 deletions components/config-mgmt-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ exec 2>&1
# We do this here because init hooks block the hab supervisor
DBNAME="{{cfg.storage.database}}"
if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "pgcrypto"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# Start our service
Expand Down
3 changes: 0 additions & 3 deletions components/data-feed-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ export DBNAME="{{cfg.storage.database}}"
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME" || exit 1
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/infra-proxy-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
echo "Creating database"
pg-helper ensure-service-database "{{cfg.storage.database}}"

echo "Creating extension"
pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
pg-helper create-extension "{{cfg.storage.database}}" "uuid-ossp"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/ingest-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ CONFIG="$CONFIG --event-feed-address 127.0.0.1:{{service.cfg.port}}"
{{~/eachAlive}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/license-control-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database chef_license_control_service
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/nodemanager-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ source {{pkg.svc_config_path}}/migration.sh
trigger_migrations

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME" || exit 1
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# cleanup old migration files
Expand Down
3 changes: 0 additions & 3 deletions components/notifications-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ render-template pg-env "{{pkg.svc_var_path}}/etc/pg-env"
source "{{pkg.svc_var_path}}/etc/pg-env"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "notifications_service"
pg-helper create-extension "notifications_service" "pgcrypto"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/notifications-service2/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "notifications_service"
pg-helper create-extension "notifications_service" "pgcrypto"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

source {{pkg.svc_config_path}}/init_proxy
Expand Down
3 changes: 0 additions & 3 deletions components/report-manager-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "{{cfg.storage.database}}"
pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
pg-helper fix-permissions "{{cfg.storage.database}}"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# cleanup old migration files
Expand Down
3 changes: 0 additions & 3 deletions components/secrets-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ source {{pkg.svc_config_path}}/migration.sh
trigger_migrations

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME" || exit 1
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# cleanup old migration files
Expand Down
3 changes: 0 additions & 3 deletions components/session-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ render-template config.yml "{{pkg.svc_var_path}}/etc/config.yml" \
--conf "{{pkg.svc_config_path}}/config.json"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "{{cfg.storage.database}}"

pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi


Expand Down
3 changes: 0 additions & 3 deletions components/teams-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ exec 2>&1
{{pkgPathFor "chef/mlsa"}}/bin/accept {{cfg.mlsa.accept}}

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
echo "Creating database"
pg-helper ensure-service-database "{{cfg.storage.database}}"

echo "Creating extension"
pg-helper create-extension "{{cfg.storage.database}}" "pgcrypto"
pg-helper create-extension "{{cfg.storage.database}}" "uuid-ossp"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# cleanup old migration files
Expand Down
3 changes: 0 additions & 3 deletions components/user-settings-service/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ exec 2>&1
DBNAME="{{cfg.storage.database}}"

if [ ! -f /hab/.skip_migration ]; then
echo "/hab/.skip_migration does not exist, running pg-helper command $(pwd)/$0 at $LINENO"
pg-helper ensure-service-database "$DBNAME"
pg-helper create-extension "$DBNAME" "pgcrypto"
pg-helper fix-permissions "$DBNAME"
else
echo "/hab/.skip_migration does exist, skipping pg-helper"
fi

# cleanup old migration files
Expand Down

0 comments on commit db13942

Please sign in to comment.