From f33829ca84a7f88438716dcd5b6ac0076ffee709 Mon Sep 17 00:00:00 2001 From: smbaker <smbaker@fc8-storktest.lan> Date: Tue, 29 Oct 2013 17:46:32 -0700 Subject: [PATCH] split off GetSlices and GetNodes from GetConfiguration --- planetstack/core/views/legacyapi.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/planetstack/core/views/legacyapi.py b/planetstack/core/views/legacyapi.py index b6494e1..e70fa57 100644 --- a/planetstack/core/views/legacyapi.py +++ b/planetstack/core/views/legacyapi.py @@ -237,19 +237,25 @@ def GetConfiguration(name): 'sites': sites, 'nodes': nodes} -def DoGetConfiguration(): +def HandleGetConfiguration(): find_multi_slicename("princeton_vcoblitz") - slices = GetSlices() - nodes = GetNodes() configs={} for slicename in ["princeton_vcoblitz"]: configs[slicename] = GetConfiguration({"name": slicename}) + return configs + +def HandleGetNodes(): + find_multi_slicename("princeton_vcoblitz") + return GetNodes() + +def HandleGetSlices(): + find_multi_slicename("princeton_vcoblitz") + return GetSlices() - result = {"configs": configs, - "slices": slices, - "nodes": nodes} - return result +FUNCS = {"GetConfiguration": HandleGetConfiguration, + "GetNodes": HandleGetNodes, + "GetSlices": HandleGetSlices} @csrf_exempt def LegacyXMLRPC(request): @@ -257,8 +263,8 @@ def LegacyXMLRPC(request): try: (args, method) = xmlrpclib.loads(request.body) result = None - if (method == "GetConfiguration"): - result = DoGetConfiguration() + if method in FUNCS: + result = FUNCS[method]() return HttpResponse(xmlrpclib.dumps((result,), methodresponse=True, allow_none=1)) except: traceback.print_exc() -- 2.47.0