Skip to content

Commit

Permalink
Added if else condition
Browse files Browse the repository at this point in the history
Signed-off-by: jan shahid shaik <jashaik@progress.com>
  • Loading branch information
jashaik committed Jan 1, 2025
1 parent ea533d3 commit 9755708
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 25 deletions.
23 changes: 16 additions & 7 deletions components/automate-cs-bookshelf/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ else
echo -n "${CURRENT_SECRET_KEY}" | secrets-helper insert bookshelf.secret_access_key
fi


exec secrets-helper exec \
--secret userconfig.pg_superuser_password \
--secret bookshelf.access_key_id \
--secret bookshelf.secret_access_key \
-- \
bookshelf foreground
export POSTGRES_DB_PW=$(secrets-helper show userconfig.pg_superuser_password || echo "")
if [ $POSTGRES_DB_PW -eq ""]
then
exec secrets-helper exec \
--secret bookshelf.access_key_id \
--secret bookshelf.secret_access_key \
-- \
bookshelf foreground
else
exec secrets-helper exec \
--secret userconfig.pg_superuser_password \
--secret bookshelf.access_key_id \
--secret bookshelf.secret_access_key \
-- \
bookshelf foreground
if
20 changes: 14 additions & 6 deletions components/automate-cs-oc-bifrost/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,17 @@ fi


secrets-helper generate oc_bifrost.superuser_id 32 --if-not-exists

exec secrets-helper exec \
--secret oc_bifrost.superuser_id \
--secret userconfig.pg_superuser_password \
-- \
oc_bifrost foreground
export POSTGRES_DB_PW=$(secrets-helper show userconfig.pg_superuser_password || echo "")
if [ $POSTGRES_DB_PW -eq ""]
then
exec secrets-helper exec \
--secret oc_bifrost.superuser_id \
-- \
oc_bifrost foreground
else
exec secrets-helper exec \
--secret oc_bifrost.superuser_id \
--secret userconfig.pg_superuser_password \
-- \
oc_bifrost foreground
if
41 changes: 29 additions & 12 deletions components/automate-cs-oc-erchef/habitat/hooks/run
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,32 @@ secrets-helper insert chef-server.webui_pub_key <{{pkg.svc_data_path}}/webui_pub
# has been addressed.
#
exec 0</dev/null
exec secrets-helper exec \
--secret oc_bifrost.superuser_id \
--secret bookshelf.access_key_id \
--secret bookshelf.secret_access_key \
--secret chef-server.webui_pub_key \
--secret userconfig.pg_superuser_password \
--optional-secret data_collector.token \
-- \
{{~#if cfg.memory.max_bytes}}
chpst -d {{cfg.memory.max_bytes}} \
{{~/if}}
oc_erchef foreground

export POSTGRES_DB_PW=$(secrets-helper show userconfig.pg_superuser_password || echo "")
if [ $POSTGRES_DB_PW -eq ""]
then
exec secrets-helper exec \
--secret oc_bifrost.superuser_id \
--secret bookshelf.access_key_id \
--secret bookshelf.secret_access_key \
--secret chef-server.webui_pub_key \
--optional-secret data_collector.token \
-- \
{{~#if cfg.memory.max_bytes}}
chpst -d {{cfg.memory.max_bytes}} \
{{~/if}}
oc_erchef foreground
else
exec secrets-helper exec \
--secret oc_bifrost.superuser_id \
--secret bookshelf.access_key_id \
--secret bookshelf.secret_access_key \
--secret chef-server.webui_pub_key \
--secret userconfig.pg_superuser_password \
--optional-secret data_collector.token \
-- \
{{~#if cfg.memory.max_bytes}}
chpst -d {{cfg.memory.max_bytes}} \
{{~/if}}
oc_erchef foreground
if

0 comments on commit 9755708

Please sign in to comment.