Skip to content
Permalink
Browse files

Support create from template in the create_multiplex() lsnr method

The create multiplex method has to fetch the template to decide
where to deploy.
  • Loading branch information...
cvaroqui committed Jul 15, 2019
1 parent 7d5bae9 commit 1c783b6229d769126ba10596ea35c458c6ba43f0
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/osvcd_lsnr.py
@@ -1545,7 +1545,13 @@ def push_peer_stream(self, stream_id, nodename, client_stream_id, conn, resp):

def create_multiplex(self, fname, options, data, original_nodename, action, stream_id=None):
h = {}
for path, svcdata in options.get("data", {}).items():
template = options.get("template")
path = options.get("path")
if template:
odata = shared.NODE.svc_conf_from_templ("dummy", None, "svc", template)
else:
odata = options.get("data", {})
for path, svcdata in odata.items():
nodes = svcdata.get("DEFAULT", {}).get("nodes")
placement = svcdata.get("DEFAULT", {}).get("placement", "nodes order")
if nodes:
@@ -2531,12 +2537,12 @@ def action_create(self, nodename, **kwargs):
"""
options = kwargs.get("options", {})
data = options.get("data")
if not data:
template = options.get("template")
if not data and not template:
return {"status": 0, "info": "no data"}
sync = options.get("sync", True)
namespace = options.get("namespace")
provision = options.get("provision")
template = options.get("template")
restore = options.get("restore")
path = options.get("path")
self.log_request("create/update %s" % ",".join([p for p in data]), nodename, **kwargs)

0 comments on commit 1c783b6

Please sign in to comment.
You can’t perform that action at this time.