Commit 3679ef5f authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support both IPv4 and IPv6 address.

parent a67c393d
...@@ -38,7 +38,7 @@ class Recipe(GenericSlapRecipe): ...@@ -38,7 +38,7 @@ class Recipe(GenericSlapRecipe):
def _install(self): def _install(self):
ip = self.options['ip'] ip = self.options['ip']
backend_url = self.parameter_dict['tidstorage-url'] backend_url = self.parameter_dict['tidstorage-url']
backend_ip, backend_port = self._getBackendServer(backend_url) backend_server, backend_port = self._getBackendServer(backend_url)
varnishd_manager_port = int(self.options['manager-port']) varnishd_manager_port = int(self.options['manager-port'])
varnishd_server_port = int(self.options['server-port']) varnishd_server_port = int(self.options['server-port'])
path_list = [] path_list = []
...@@ -53,9 +53,8 @@ class Recipe(GenericSlapRecipe): ...@@ -53,9 +53,8 @@ class Recipe(GenericSlapRecipe):
varnish_data=self.options['varnish-data'], varnish_data=self.options['varnish-data'],
shell_path=self.options['shell-path'], shell_path=self.options['shell-path'],
vcl_file=self.options['vcl-file'], vcl_file=self.options['vcl-file'],
backend_ip = backend_ip, backend_port=backend_port,
backend_port = backend_port, backend_server=backend_server,
backend_server = "[%s]" % backend_ip,
) )
path_list.append(self.createExecutable(self.options['varnishd-wrapper'], path_list.append(self.createExecutable(self.options['varnishd-wrapper'],
...@@ -70,7 +69,7 @@ class Recipe(GenericSlapRecipe): ...@@ -70,7 +69,7 @@ class Recipe(GenericSlapRecipe):
return path_list return path_list
def _getBackendServer(self, url): def _getBackendServer(self, url):
r = re.compile('\/\/\[(.*)\]:(\d*)') r = re.compile('\/\/(\[.+\]|[\d.]+):(\d*)')
result = r.search(url) result = r.search(url)
ip = result.groups()[0] ip = result.groups()[0]
port = result.groups()[1] port = result.groups()[1]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment