modify funciton name for cluster template
Change-Id: Ic22c9bf2a57b97ceceff9507c59b983d59960c91
This commit is contained in:
parent
566a1f4a41
commit
56e030c14c
@ -27,6 +27,7 @@ from webob import Response
|
|||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from oslo_utils import importutils
|
||||||
from daisy.api import policy
|
from daisy.api import policy
|
||||||
import daisy.api.v1
|
import daisy.api.v1
|
||||||
from daisy.api.v1 import controller
|
from daisy.api.v1 import controller
|
||||||
@ -650,18 +651,6 @@ class Controller(controller.BaseController):
|
|||||||
add_network_meta = registry.add_network_metadata(
|
add_network_meta = registry.add_network_metadata(
|
||||||
req.context, template_content_network)
|
req.context, template_content_network)
|
||||||
|
|
||||||
path = os.path.join(os.path.abspath(os.path.dirname(
|
|
||||||
os.path.realpath(__file__))), 'ext')
|
|
||||||
for root, dirs, names in os.walk(path):
|
|
||||||
filename = 'router.py'
|
|
||||||
if filename in names:
|
|
||||||
ext_name = root.split(path)[1].strip('/')
|
|
||||||
ext_func = "%s.api.hosts" % ext_name
|
|
||||||
extension = importutils.import_module(
|
|
||||||
'daisy.api.v1.ext.%s' % ext_func)
|
|
||||||
if 'modify_cluster_about_hwm' in dir(extension):
|
|
||||||
extension.modify_cluster_about_hwm(req, cluster_id)
|
|
||||||
|
|
||||||
params = {'filters': {'cluster_id': cluster_id}}
|
params = {'filters': {'cluster_id': cluster_id}}
|
||||||
roles = registry.get_roles_detail(req.context, **params)
|
roles = registry.get_roles_detail(req.context, **params)
|
||||||
template_content_roles = template_content['roles']
|
template_content_roles = template_content['roles']
|
||||||
@ -691,6 +680,19 @@ class Controller(controller.BaseController):
|
|||||||
template_content['services_disk'],
|
template_content['services_disk'],
|
||||||
roles)
|
roles)
|
||||||
|
|
||||||
|
# add extension content for cluster_template
|
||||||
|
path = os.path.join(os.path.abspath(os.path.dirname(
|
||||||
|
os.path.realpath(__file__))), 'ext')
|
||||||
|
for root, dirs, names in os.walk(path):
|
||||||
|
filename = 'router.py'
|
||||||
|
if filename in names:
|
||||||
|
ext_name = root.split(path)[1].strip('/')
|
||||||
|
ext_func = "%s.api.hosts" % ext_name
|
||||||
|
extension = importutils.import_module(
|
||||||
|
'daisy.api.v1.ext.%s' % ext_func)
|
||||||
|
if 'import_template_to_db_ext' in dir(extension):
|
||||||
|
extension.import_template_to_db_ext(req, cluster_id)
|
||||||
|
|
||||||
except exception.Invalid as e:
|
except exception.Invalid as e:
|
||||||
raise HTTPBadRequest(explanation=e.msg, request=req)
|
raise HTTPBadRequest(explanation=e.msg, request=req)
|
||||||
return {"template": cluster_meta}
|
return {"template": cluster_meta}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user