You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/12/12 16:59:47 UTC
[trafficcontrol] 02/04: CIAB: Fix - Load server.json files at the
end
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 5a802c2af67db23eacddc20cf03e314860e41e3e
Author: Jeffrey Bevill <Je...@comcast.com>
AuthorDate: Fri Dec 7 12:49:03 2018 -0700
CIAB: Fix - Load server.json files at the end
---
.../cdn-in-a-box/traffic_ops/to-access.sh | 22 +++++++++++++++++-----
.../cdn-in-a-box/traffic_ops/trafficops-init.sh | 8 ++++++--
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
index 60cf3aa..5ce8ccb 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
@@ -136,16 +136,29 @@ to-delete() {
# serverType - the type of the server to be created; one of "edge", "mid", "tm"
to-enroll() {
- while true; do
- [ -d "${ENROLLER_DIR}/servers" ] && break
- echo "Waiting for ${ENROLLER_DIR}/servers ..."
+ # Force fflush() on /shared
+ sync
+
+ # Wait for the initial data load to be copied
+ until [[ -f "$ENROLLER_DIR/initial-load-done" ]] ; do
+ echo "Waiting for enroller initial data load to complete...."
+ sleep 2
sync
+ done
+
+ # Wait for the Enroller servers directory to be created
+ until [[ -d "${ENROLLER_DIR}/servers" ]] ; do
+ echo "Waiting for ${ENROLLER_DIR}/servers ..."
sleep 2
+ sync
done
+ # If the servers dir vanishes, the docker shared volume isn't working right
if [[ ! -d ${ENROLLER_DIR}/servers ]]; then
- echo "${ENROLLER_DIR}/servers not found -- contents:"
+ echo "ERROR: ${ENROLLER_DIR}/servers not found -- contents:"
find ${ENROLLER_DIR} -ls
+ echo "ERROR: Halting Execution."
+ tail -F /dev/null
fi
local serverType="$1"
@@ -243,7 +256,6 @@ to-enroll() {
esac
# replace env references in the file
- mkdir -p ${ENROLLER_DIR}/servers
envsubst < "/server_template.json" > "${ENROLLER_DIR}/servers/$HOSTNAME.json"
sleep 3
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh b/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh
index d41790d..711f3ba 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh
@@ -80,17 +80,21 @@ load_data_from() {
local status=0
for d in $endpoints; do
[[ -d $d ]] || continue
+ # Let containers know to write out server.json
+ if [[ "$d" = "deliveryservice_servers" ]] ; then
+ touch "$ENROLLER_DIR/initial-load-done"
+ sync
+ fi
for f in "$d"/*.json; do
echo "Loading $f"
delayfor "$f"
envsubst "$vars" <$f > "$ENROLLER_DIR"/$f
+ sync
done
done
if [[ $status -ne 0 ]]; then
exit $status
fi
- # After done loading all data
- touch "$ENROLLER_DIR/initial-load-done"
cd -
}