2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-11 18:28:11 +00:00

Begin wiring up osimage to core

This commit is contained in:
Jarrod Johnson 2020-05-07 16:26:27 -04:00
parent d90e87e153
commit 6fa863e8f9

View File

@ -46,6 +46,7 @@ import confluent.exceptions as exc
import confluent.messages as msg
import confluent.networking.macmap as macmap
import confluent.noderange as noderange
import confluent.osimage as osimage
try:
import confluent.shellmodule as shellmodule
except ImportError:
@ -125,8 +126,9 @@ def load_plugins():
sys.path.pop(1)
rootcollections = ['discovery/', 'events/', 'networking/',
'noderange/', 'nodes/', 'nodegroups/', 'usergroups/' , 'users/', 'version']
rootcollections = ['deployment/', 'discovery/', 'events/', 'networking/',
'noderange/', 'nodes/', 'nodegroups/', 'usergroups/' ,
'users/', 'version']
class PluginRoute(object):
@ -138,6 +140,26 @@ class PluginCollection(object):
def __init__(self, routedict):
self.routeinfo = routedict
def handle_deployment(configmanager, inputdata, pathcomponents,
operation):
if len(pathcomponents) == 1:
yield msg.ChildCollection('distributions')
yield msg.ChildCollection('profiles')
return
if pathcomponents[1] == 'distributions':
if len(pathcomponents) == 2:
for dist in osimage.list_distros():
yield msg.ChildCollection(dist)
return
if pathcomponents[1] == 'profiles':
if len(pathcomponents) == 2:
for prof in osimage.list_profiles():
yield msg.ChildCollection(dist)
return
raise exc.NotFoundException('Unrecognized request')
def _init_core():
global noderesources
global nodegroupresources
@ -1080,6 +1102,9 @@ def handle_path(path, operation, configmanager, inputdata=None, autostrip=True):
elif pathcomponents[0] == 'noderange':
return handle_node_request(configmanager, inputdata, operation,
pathcomponents, autostrip)
elif pathcomponents[0] == 'deployment':
return handle_deployment(configmanager, inputdata, pathcomponents,
operation)
elif pathcomponents[0] == 'nodegroups':
return handle_nodegroup_request(configmanager, inputdata,
pathcomponents,