Permalink
Browse files

Removed orphaned Consul services.

  • Loading branch information...
darron committed Sep 2, 2014
1 parent 1338266 commit 0c9a5737e4270507e253a5fd079038865aeef6c4
Showing with 12 additions and 0 deletions.
  1. +12 −0 bin/octo
View
@@ -102,6 +102,8 @@ inspect_to_get_container_name()
if echo $tag | grep -q "CONTAINER_NAME"
then
CONTAINER_NAME=$(echo $tag | cut -d '"' -f 2 | cut -d '=' -f 2-10)
else
CONTAINER_NAME=$(sudo docker inspect -f '{{json .Config.Image}}' $ID | cut -d '"' -f 2)
fi
done
echo $CONTAINER_NAME
@@ -395,6 +397,16 @@ case "$1" in
BASE=$(inspect_to_get_container_name)
/usr/bin/octo service:rm $BASE $PORT
done
# Remove HTTP tagged orphans from crashed containers.
for service in $(/usr/bin/octo services); do
if echo $service | grep -q 'http'
then
ID=$(echo $service | jq .ID | cut -d '"' -f 2)
PORT=$(echo $ID | grep -o [0-9]*$)
BASE=${ID%-$PORT}
/usr/bin/octo service:rm $BASE $PORT
fi
done
;;
domains:set)

0 comments on commit 0c9a573

Please sign in to comment.