Skip to content

Commit db4c23f

Browse files
committed
Fix handling of cd errors.
1 parent be0caa1 commit db4c23f

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

products/rg_imgbldr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ Outputs:
349349
Description: Nextflow_Advanced Image Builder Pipeline
350350
Value: !Ref NextflowAdvancedImagePipeline
351351
Export:
352-
Name: "NextflowAdvancedImagePipeline"
352+
Name: !Sub "${AWS::StackName}-NextflowAdvancedImagePipeline"
353353
RStudioImagePipeline:
354354
Description: RStudio Image Builder Pipeline
355355
Value: !Ref RStudioImagePipeline
356356
Export:
357-
Name: "RStudioPipelineName"
357+
Name: !Sub "${AWS::StackName}-RStudioPipelineName"

scripts/fixmongo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ db.createUser({user: "admin",pwd: "$2",roles: [ { role: "userAdminAnyDatabase",
9393
db.createUser({user: "$3", pwd: "$4", roles: [{role: 'readWriteMinusDropRole', db: "$1"}]})
9494
EOF
9595

96+
# trunk-ignore(shellcheck/SC2181)
9697
[ $? -gt 0 ] && echo "Could not create roles and configs. Exiting!" && exit 1
9798
rootca="${RG_HOME}/config/rootCA.key"
9899
rlca="${RG_HOME}/config/RL-CA.pem"
@@ -121,7 +122,6 @@ else
121122
exit 1
122123
fi
123124

124-
cd "$RG_HOME" || exit
125125
if [ -f "$RG_HOME/docker-compose.yml" ]; then
126126
echo "docker-compose.yml exists"
127127
sed -i -e "s/DB_HOST.*/DB_HOST=$myip/" "$RG_HOME/docker-compose.yml"

scripts/fixswarm.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/bin/bash
2-
version="0.1.2"
2+
version="0.1.3"
33
echo "Fixing swarm....(fixswarm.sh v$version)"
44

5-
[ -z $RG_HOME ] && RG_HOME='/opt/deploy/sp2'
5+
[ -z "$RG_HOME" ] && RG_HOME='/opt/deploy/sp2'
66
echo "RG_HOME=$RG_HOME"
77

88
# Remove the stack which is deployed if any
9-
cd "$RG_HOME"
109
echo "Removing sp2 stack"
1110
docker stack remove sp2
12-
old_secrets=$(docker secret ls | grep -i sp2prod | awk '{print $1}' )
13-
if [ ! -z "$old_secrets" ]; then
14-
echo "Found old secrets. Removing..."
15-
docker secret rm $old_secrets
11+
old_secrets=$(docker secret ls | grep -i sp2prod | awk '{print $1}')
12+
if [ -n "$old_secrets" ]; then
13+
echo "Found old secrets. Removing..."
14+
echo "$old_secrets" |
15+
while IFS=$'\n' read -r mysecret; do
16+
docker secret rm "$mysecret"
17+
done
1618
fi
1719
echo "Waiting 15 seconds"
1820
sleep 15
@@ -23,8 +25,10 @@ docker swarm leave --force
2325

2426
# Remove the ingress network that is stuck
2527
echo "Removing the stuck ingress network"
26-
docker network ls | grep -e 'ingress.*overlay' | awk '{print $1}'
28+
docker network rm ingress
29+
#docker network ls | grep -e 'ingress.*overlay' | awk '{print $1}'
2730

31+
# trunk-ignore(shellcheck/SC2181)
2832
[ $? -gt 0 ] && echo "Could not remove ingress network. Exiting" && exit 0
2933

3034
echo "You can now re-deploy your stack using start_server.sh"

0 commit comments

Comments
 (0)