Skip to content
Permalink
Browse files

Accept the "template" option in the create handler

And expose a "get_node" handler, reporting what is probed by
"om node pushasset".
  • Loading branch information...
cvaroqui committed Jul 11, 2019
1 parent 462ec26 commit 4b800a86fcbf443b436d457eb17641b41c3613ab
Showing with 18 additions and 2 deletions.
  1. +18 −2 lib/osvcd_lsnr.py
@@ -2386,6 +2386,11 @@ def find_opt(opt):

def rbac_action_create(self, nodename, **kwargs):
options = kwargs.get("options", {})
template = options.get("template")
namespace = options.get("namespace")
if template is not None:
self.rbac_requires(roles=["admin"], namespaces=[namespace], **kwargs)
return
data = options.get("data")
if not data:
return
@@ -2407,9 +2412,13 @@ def action_create(self, nodename, **kwargs):
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)
if template is not None:
cmd = ["create", "--template=%s" % template, "--env=-"]
if path:
cmd = ["create", "-s", path, "--template=%s" % template, "--env=-"]
else:
cmd = ["create", "--template=%s" % template, "--env=-"]
else:
cmd = ["create", "--config=-"]
if namespace:
@@ -2420,7 +2429,7 @@ def action_create(self, nodename, **kwargs):
if sync:
out, err = proc.communicate()
result = {
"status": 0,
"status": proc.returncode,
"data": {
"out": bdecode(out),
"err": bdecode(err),
@@ -2905,6 +2914,13 @@ def action_get_template(self, nodename, **kwargs):
raise HTTP(404, "template not found")
raise HTTP(400, "unknown catalog %s" % catalog)

def rbac_action_get_node(self, nodename, **kwargs):
self.rbac_requires(roles=["guest"], namespaces="ANY", **kwargs)

def action_get_node(self, nodename, **kwargs):
data = shared.NODE.asset.get_asset_dict()
return data


##########################################################################
#

0 comments on commit 4b800a8

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