airbnb/synapse — pull request #45 by bobtfish (2014-02-08 19:59:39+00:00)
Title: Fix discovery when some containers have no forwarded ports

In the new API, docker can return nil in the JSON to indicate a container
has no ports forwarded. This notably happens when you're using the 'docker build'
command, and breaks synapse's discovery for the duration.

If you have a long running container with no ports forwarded, then
it's just always broken.

This fixes that bug and breaks out rewrite_container_ports into it's own
method as it's complex enough to justify it. Tests are added for the
3 (old/new/nil) cases that this method deals with