Skip to content

Commit

Permalink
Don't try to get port if id isn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffutter committed Nov 22, 2013
1 parent 7ebea62 commit dccee02
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions commands
Expand Up @@ -29,11 +29,13 @@ check_container() {

db_image="jeffutter/riakcs"
id=$(docker ps | grep "$db_image":latest | awk '{print $1}')
riak_public_ip=$(docker port ${id} 8080 | awk '{split($0,a,":"); print a[1]}')
riak_private_ip=$(docker inspect ${id} | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
riak_port=$(docker port ${id} 8080 | awk '{split($0,a,":"); print a[2]}')
if [[ $riak_public_ip = "0.0.0.0" ]]; then
riak_public_ip=localhost
if [[ -n "$id" ]]; then
riak_public_ip=$(docker port ${id} 8080 | awk '{split($0,a,":"); print a[1]}')
riak_private_ip=$(docker inspect ${id} | grep IPAddress | awk '{ print $2 }' | tr -d ',"')
riak_port=$(docker port ${id} 8080 | awk '{split($0,a,":"); print a[2]}')
if [[ $riak_public_ip = "0.0.0.0" ]]; then
riak_public_ip=localhost
fi
fi
bucket_name="${APP}-default"

Expand Down

0 comments on commit dccee02

Please sign in to comment.