From 7f5af0708b4515d1de8cacd83fee4e460614f4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=A1gr?= Date: Fri, 23 Jan 2015 13:08:32 +0100 Subject: [PATCH] IPv6 fixes This patch makes validate_ssh works for IPv6 addresses.Also file transport via scp has been fixed to work via IPv6 address Change-Id: I55c88d3fcaaa8decd647aa38404ac653d5f5dbba --- packstack/installer/validators.py | 4 ++-- packstack/plugins/puppet_950.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packstack/installer/validators.py b/packstack/installer/validators.py index 6b6be3f90..6b7de387e 100644 --- a/packstack/installer/validators.py +++ b/packstack/installer/validators.py @@ -138,7 +138,7 @@ def validate_ip(param, options=None): for family in (socket.AF_INET, socket.AF_INET6): try: socket.inet_pton(family, param) - break + return family except socket.error: continue else: @@ -213,7 +213,7 @@ def touch_port(host, port): key = "%s:%d" % (host, port) if key in _tested_ports: return - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s = socket.socket(validate_ip(host), socket.SOCK_STREAM) s.connect((host, port)) s.shutdown(socket.SHUT_RDWR) s.close() diff --git a/packstack/plugins/puppet_950.py b/packstack/plugins/puppet_950.py index a71669468..957df0506 100644 --- a/packstack/plugins/puppet_950.py +++ b/packstack/plugins/puppet_950.py @@ -85,7 +85,7 @@ def wait_for_puppet(currently_running, messages): log = log.replace(".finished", ".log") local_server.append('scp -o StrictHostKeyChecking=no ' '-o UserKnownHostsFile=/dev/null ' - 'root@%s:%s %s' + 'root@[%s]:%s %s' % (hostname, finished_logfile, log)) # To not pollute logs we turn of logging of command execution local_server.execute(log=False) @@ -209,7 +209,7 @@ def copy_puppet_modules(config, messages): for path, localname in resources.get(hostname, []): server.append("scp -o StrictHostKeyChecking=no " "-o UserKnownHostsFile=/dev/null " - "%s root@%s:%s/resources/%s" % + "%s root@[%s]:%s/resources/%s" % (path, hostname, host_dir, localname)) # copy Puppet modules required by Packstack