signalfx / maestro-ng

Orchestration of Docker-based, multi-host environments
https://signalfx.com
Apache License 2.0
685 stars 83 forks source link

Lifecycle check is not working if the Ship ip is in IPv6 format #183

Closed rahul-rj closed 7 years ago

rahul-rj commented 7 years ago

TcpPortPinger class in lifecycle.py always expects the ship ip to be in IPv4 format and if the IP is in IPv6 format the lifecycle check fails lifecycle.py

   def _test(self, container=None):
        try:
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.settimeout(1)
            s.connect((self.host, self.port))
            s.close()
            return True
        except Exception:
            return False

We should first check if the IP is in IPv6 or IPv4 format and then updated the socket.AF.INET function to socket.AF.INET6 if its an IPv6 format. I will try to update the code and raise a Pull request to update the same. If you have any suggestion please let us know.

Thanks, Rahul Jain