Commit 8a682db3 authored by Levin Zimmermann's avatar Levin Zimmermann

Revert "stack/erp5: Fix NEO URL formatting for WCFS"

This reverts commit 0cf70a6e.

NEOgo and NEOpy diverged wrt the NEO URI format. Due to NEOgo
changes in the NEO URI format 0cf70a6e was necessary.
However in neoppod!18 and
neoppod!21 a common
URI format for NEOgo and NEOpy was agreed on. Therefore most changes of
0cf70a6e are no
longer necessary. We still need the difference between 'neo' (without
SSL) and 'neos' (with SSL), but we'll re-introduce this in the next
commit.

This revert keeps the changes made in 6fa1d9ae as this is still
needed.

/reviewed-by @kirr @jerome
/reviewed-on !1620
parent 7d42c419
...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04 ...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 1a81908e9716dedba4f397f37264b015 md5sum = 6d9a926e07b674ffdaecd381d763c068
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
...@@ -102,4 +102,4 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8 ...@@ -102,4 +102,4 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8
[instance-wcfs.cfg.in] [instance-wcfs.cfg.in]
filename = instance-wcfs.cfg.in filename = instance-wcfs.cfg.in
md5sum = a495f84194a46c585b89947f8bc7d754 md5sum = 36a5adc0fb9756836ee31def4084a088
{# instance that runs WCFS service associated with ZODB storage #} {# instance that runs WCFS service associated with ZODB storage #}
{% from "instance_zodb_base" import zodb_dict with context %} {% from "instance_zodb_base" import zodb_dict with context %}
{# q(text) returns urllib.quote_plus(text) #}
{% macro q(text) %}{{ urllib_parse.quote_plus(text) }}{% endmacro %}
{# build zurl to connect to configured ZODB #} {# build zurl to connect to configured ZODB #}
{% if len(zodb_dict) != 1 -%} {% if len(zodb_dict) != 1 -%}
...@@ -14,18 +12,15 @@ ...@@ -14,18 +12,15 @@
{% if zodb['type'] == 'zeo' -%} {% if zodb['type'] == 'zeo' -%}
{% set zurl = ('zeo://%s?storage=%s' % (z['server'], z['storage'])) -%} {% set zurl = ('zeo://%s?storage=%s' % (z['server'], z['storage'])) -%}
{% elif zodb['type'] == 'neo' -%} {% elif zodb['type'] == 'neo' -%}
{# neo(s)://[credentials@]master1,master2,...,masterN/name?options #} {% set zurl = ('neo://%s@%s' % (z.pop('name'), z.pop('master_nodes')|replace(" ", ","))) -%}
{# (see https://lab.nexedi.com/kirr/neo/blob/3e13fa06/go/neo/client.go#L417) #} {% set argv = [] -%}
{# If 'ca' in storage-dict, ssl is true. #} {% set i = 0 -%}
{# (see https://lab.nexedi.com/nexedi/slapos/blob/397726e1/stack/erp5/instance-zodb-base.cfg.in#L17-21) #} {% for k,v in z|dictsort -%}
{% if "ca" in z -%} {% do argv.append('%s=%s' % (k,v)) -%}
{# ca=ca.crt;cert=my.crt;key=my.key (see https://lab.nexedi.com/kirr/neo/blob/3e13fa06/go/neo/client.go#L428) #} {% endfor -%}
{% set zurl = 'neos://ca=%s;cert=%s;key=%s@' % (q(z.pop("ca")), q(z.pop("cert")), q(z.pop("key"))) -%} {% if len(argv) > 0 -%}
{% else -%} {% set zurl = zurl + '&' + '?'.join(argv) -%}
{% set zurl = 'neo://' -%}
{% endif -%} {% endif -%}
{% set zurl = ('%s%s/%s' % (zurl, z.pop('master_nodes')|replace(" ", ","), z.pop('name'))) -%}
{% set zurl = zurl + '?' + (z | dictsort | urlencode) -%}
{% else -%} {% else -%}
{% do assert(False, ("unsupported ZODB type", zodb)) -%} {% do assert(False, ("unsupported ZODB type", zodb)) -%}
{% endif -%} {% endif -%}
......
...@@ -219,7 +219,6 @@ url = {{ instance_wcfs_cfg_in }} ...@@ -219,7 +219,6 @@ url = {{ instance_wcfs_cfg_in }}
filename = instance_wcfs.cfg filename = instance_wcfs.cfg
extra-context = extra-context =
section parameter_dict dynamic-template-zope-parameters section parameter_dict dynamic-template-zope-parameters
import urllib_parse six.moves.urllib.parse
import-list = import-list =
file instance_zodb_base context:template-zodb-base file instance_zodb_base context:template-zodb-base
......
...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04 ...@@ -70,7 +70,7 @@ md5sum = b95084ae9eed95a68eada45e28ef0c04
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 39e391372cc616ea5d1d6559621e6747 md5sum = 8e452bd32fc0d4d858b275a2b3ee790b
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
...@@ -106,4 +106,4 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8 ...@@ -106,4 +106,4 @@ md5sum = 5cf0316fdd17a940031e4083bbededd8
[instance-wcfs.cfg.in] [instance-wcfs.cfg.in]
filename = instance-wcfs.cfg.in filename = instance-wcfs.cfg.in
md5sum = a495f84194a46c585b89947f8bc7d754 md5sum = 36a5adc0fb9756836ee31def4084a088
{# instance that runs WCFS service associated with ZODB storage #} {# instance that runs WCFS service associated with ZODB storage #}
{% from "instance_zodb_base" import zodb_dict with context %} {% from "instance_zodb_base" import zodb_dict with context %}
{# q(text) returns urllib.quote_plus(text) #}
{% macro q(text) %}{{ urllib_parse.quote_plus(text) }}{% endmacro %}
{# build zurl to connect to configured ZODB #} {# build zurl to connect to configured ZODB #}
{% if len(zodb_dict) != 1 -%} {% if len(zodb_dict) != 1 -%}
...@@ -14,18 +12,15 @@ ...@@ -14,18 +12,15 @@
{% if zodb['type'] == 'zeo' -%} {% if zodb['type'] == 'zeo' -%}
{% set zurl = ('zeo://%s?storage=%s' % (z['server'], z['storage'])) -%} {% set zurl = ('zeo://%s?storage=%s' % (z['server'], z['storage'])) -%}
{% elif zodb['type'] == 'neo' -%} {% elif zodb['type'] == 'neo' -%}
{# neo(s)://[credentials@]master1,master2,...,masterN/name?options #} {% set zurl = ('neo://%s@%s' % (z.pop('name'), z.pop('master_nodes')|replace(" ", ","))) -%}
{# (see https://lab.nexedi.com/kirr/neo/blob/3e13fa06/go/neo/client.go#L417) #} {% set argv = [] -%}
{# If 'ca' in storage-dict, ssl is true. #} {% set i = 0 -%}
{# (see https://lab.nexedi.com/nexedi/slapos/blob/397726e1/stack/erp5/instance-zodb-base.cfg.in#L17-21) #} {% for k,v in z|dictsort -%}
{% if "ca" in z -%} {% do argv.append('%s=%s' % (k,v)) -%}
{# ca=ca.crt;cert=my.crt;key=my.key (see https://lab.nexedi.com/kirr/neo/blob/3e13fa06/go/neo/client.go#L428) #} {% endfor -%}
{% set zurl = 'neos://ca=%s;cert=%s;key=%s@' % (q(z.pop("ca")), q(z.pop("cert")), q(z.pop("key"))) -%} {% if len(argv) > 0 -%}
{% else -%} {% set zurl = zurl + '&' + '?'.join(argv) -%}
{% set zurl = 'neo://' -%}
{% endif -%} {% endif -%}
{% set zurl = ('%s%s/%s' % (zurl, z.pop('master_nodes')|replace(" ", ","), z.pop('name'))) -%}
{% set zurl = zurl + '?' + (z | dictsort | urlencode) -%}
{% else -%} {% else -%}
{% do assert(False, ("unsupported ZODB type", zodb)) -%} {% do assert(False, ("unsupported ZODB type", zodb)) -%}
{% endif -%} {% endif -%}
......
...@@ -223,7 +223,6 @@ url = {{ instance_wcfs_cfg_in }} ...@@ -223,7 +223,6 @@ url = {{ instance_wcfs_cfg_in }}
filename = instance_wcfs.cfg filename = instance_wcfs.cfg
extra-context = extra-context =
section parameter_dict dynamic-template-zope-parameters section parameter_dict dynamic-template-zope-parameters
import urllib_parse six.moves.urllib.parse
import-list = import-list =
file instance_zodb_base context:template-zodb-base file instance_zodb_base context:template-zodb-base
......
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