Commit 7f8fa32a authored by Kirill Smelkov's avatar Kirill Smelkov

X lib/zodb: zstor_2zurl += NEO/SSL support

Depends on custom patch to remember SSL credentials on NEO Client, and
also on patches to rework neo:// URLs to not keep credentials inside
query.

neo@b9a42957
neo@8c974485
neo@a2f192cb
parent 03a9ef33
......@@ -27,6 +27,7 @@ from ZODB.utils import p64, u64
from persistent import Persistent
from weakref import WeakSet
import gc
from six.moves.urllib import parse as urlparse
import pkg_resources
......@@ -369,10 +370,16 @@ def zstor_2zurl(zstor):
# NEO
if ztype == "neo.client.Storage.Storage":
# neo://<cluster>@<master>
u = "neo://"
# neo(s)://[<credentials>@]<master>/<cluster>
app = zstor.app
u += "%s@" % app.name
if not app.ssl:
u = "neo://"
else:
q = urlparse.quote_plus
u = "neos://"
ca, cert, key = app.ssl_credentials # .ssl_credentials depend on kirr's patch
u += "ca=%s;cert=%s;key=%s@" % (q(ca), q(cert), q(key))
masterv = app.nm.getMasterList()
if len(masterv) == 0:
raise RuntimeError("%r has empty master list" % zstor)
......@@ -382,8 +389,8 @@ def zstor_2zurl(zstor):
host, port = master.getAddress()
u += "%s:%s" % (host, port)
# TODO ssl
return u
u += "/%s" % app.name
return u
raise NotImplementedError("don't know how to extract zurl from %r" % zstor)
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