Skip to content

Commit cbd7993

Browse files
author
Dougal Ballantyne
committed
Adding support for pre/post install script args
1 parent e1de527 commit cbd7993

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

bootstrap/src/scripts/boot_as_compute

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ function error_exit () {
2525
# Run preinstall script if defined
2626
RC=0
2727
if [ "${cfn_preinstall}" != "NONE" ]; then
28-
wget -qO- ${cfn_preinstall} | /bin/sh || RC=1
28+
tmpfile=$(mktemp)
29+
wget -qO- ${cfn_preinstall} > $tmpfile || RC=1
30+
if [ "${cfn_preinstall_args}" != "NONE"]; then
31+
args=${cfn_preinstall_args}
32+
fi
33+
/bin/sh $tmpfile $args || RC=1
34+
/bin/rm $tmpfile
2935
fi
3036
if [ $RC -ne 0 ]; then
3137
error_exit "Failed to run boot_as_compute preinstall"
@@ -124,7 +130,13 @@ fi
124130
# Run postinstall script if defined
125131
RC=0
126132
if [ "${cfn_postinstall}" != "NONE" ]; then
127-
wget -qO- ${cfn_postinstall} | /bin/sh || RC=1
133+
tmpfile=$(mktemp)
134+
wget -qO- ${cfn_postinstall} > $tmpfile || RC=1
135+
if [ "${cfn_postinstall_args}" != "NONE"]; then
136+
args=${cfn_postinstall_args}
137+
fi
138+
/bin/sh $tmpfile $args || RC=1
139+
/bin/rm $tmpfile
128140
fi
129141
if [ $RC -ne 0 ]; then
130142
error_exit "Failed to run boot_as_compute postinstall"

bootstrap/src/scripts/boot_as_master

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ function error_exit () {
2525
# Run preinstall script if defined
2626
RC=0
2727
if [ "${cfn_preinstall}" != "NONE" ]; then
28-
wget -qO- ${cfn_preinstall} | /bin/sh || RC=1
28+
tmpfile=$(mktemp)
29+
wget -qO- ${cfn_preinstall} > $tmpfile || RC=1
30+
if [ "${cfn_preinstall_args}" != "NONE"]; then
31+
args=${cfn_preinstall_args}
32+
fi
33+
/bin/sh $tmpfile $args || RC=1
34+
/bin/rm $tmpfile
2935
fi
3036
if [ $RC -ne 0 ]; then
3137
error_exit "Failed to run boot_as_master preinstall"
@@ -200,7 +206,13 @@ cd /opt/cfncluster/sqswatcher && ./sqswatcher.py 2>&1
200206
# Run postinstall script if defined
201207
RC=0
202208
if [ "${cfn_postinstall}" != "NONE" ]; then
203-
wget -qO- ${cfn_postinstall} | /bin/sh || RC=1
209+
tmpfile=$(mktemp)
210+
wget -qO- ${cfn_postinstall} > $tmpfile || RC=1
211+
if [ "${cfn_postinstall_args}" != "NONE"]; then
212+
args=${cfn_postinstall_args}
213+
fi
214+
/bin/sh $tmpfile $args || RC=1
215+
/bin/rm $tmpfile
204216
fi
205217
if [ $RC -ne 0 ]; then
206218
error_exit "Failed to run boot_as_master postinstall"

0 commit comments

Comments
 (0)