Skip to content

Commit fde5e87

Browse files
committed
browser-emulator: fix notify-aws.sh: AWS_STACK: unbound variable
1 parent b44a806 commit fde5e87

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

browser-emulator/notify-aws.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@ set -o xtrace
99

1010
pip3 install --break-system-packages https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz
1111

12+
# Ensure AWS_STACK and AWS_REGION are available. If not set in the current
13+
# environment, try loading them from /etc/environment (CloudFormation writes
14+
# these there in userdata). Use safe expansions to avoid nounset failures.
15+
if [ -z "${AWS_STACK:-}" ] || [ -z "${AWS_REGION:-}" ]; then
16+
if [ -f /etc/environment ]; then
17+
. /etc/environment || true
18+
fi
19+
fi
20+
21+
if [ -z "${AWS_STACK:-}" ] || [ -z "${AWS_REGION:-}" ]; then
22+
echo "Required AWS variables AWS_STACK or AWS_REGION not set" >&2
23+
exit 1
24+
fi
25+
1226
# sending the finish call
13-
cfn-signal -e 0 --stack ${AWS_STACK} --resource BrowserInstance --region ${AWS_REGION}
27+
cfn-signal -e 0 --stack "${AWS_STACK}" --resource BrowserInstance --region "${AWS_REGION}"
1428

1529
echo "Instance is ready"

0 commit comments

Comments
 (0)