From f7321f4e70dc9904cb7c7e84eabcacf43af7a36f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 28 Mar 2014 14:59:37 -0400 Subject: [PATCH] Rename nodes and groups collections It has been expressed that plural form for collection names are preferred. Additionally, tab completion is nicer if names do not share so much leading characters. --- bin/confetty | 2 +- confluent/consoleserver.py | 2 +- confluent/httpapi.py | 6 +++--- confluent/pluginapi.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/confetty b/bin/confetty index 71bc4a95..bba5e20f 100755 --- a/bin/confetty +++ b/bin/confetty @@ -368,7 +368,7 @@ inconsole = False pendingcommand = "" if len(args) == 1: # a node name, go straight to trying to console consoleonly = True - do_command("start /node/%s/console/session" % args[0], server) + do_command("start /nodes/%s/console/session" % args[0], server) while not doexit: if inconsole: rdylist, _, _ = select.select((sys.stdin, session.connection), (), (), 60) diff --git a/confluent/consoleserver.py b/confluent/consoleserver.py index b4140219..b0f28d58 100644 --- a/confluent/consoleserver.py +++ b/confluent/consoleserver.py @@ -38,7 +38,7 @@ class _ConsoleHandler(object): def _connect(self): self._console = plugin.handle_path( - "/node/%s/_console/session" % self.node, + "/nodes/%s/_console/session" % self.node, "create", self.cfgmgr) self._console.connect(self.get_console_output) diff --git a/confluent/httpapi.py b/confluent/httpapi.py index 15f106d7..bd0e1376 100644 --- a/confluent/httpapi.py +++ b/confluent/httpapi.py @@ -71,8 +71,8 @@ def node_creation_resources(): desc=attribs.node[attr]['description']).html() + '
\n' create_resource_functions = { - '/node/': node_creation_resources, - '/nodegroup/': group_creation_resources, + '/nodes/': node_creation_resources, + '/groups/': group_creation_resources, } @@ -356,7 +356,7 @@ def _assemble_html(responses, resource, querydict, url): firstpass = True for y in create_resource_functions[url](): if firstpass: - yield "
Define new %s:
" % url.split("/")[-2] + yield "
Define new resource in %s:
" % url.split("/")[-2] firstpass = False yield y yield ('' diff --git a/confluent/pluginapi.py b/confluent/pluginapi.py index 7733102d..b8aacc60 100644 --- a/confluent/pluginapi.py +++ b/confluent/pluginapi.py @@ -58,7 +58,7 @@ def load_plugins(): pluginmap[plugin] = tmpmod -rootcollections = ['node/', 'nodegroup/'] +rootcollections = ['nodes/', 'groups/'] class PluginRoute(object): @@ -151,7 +151,7 @@ def enumerate_nodegroup_collection(collectionpath, configmanager): return iterate_resources(collection) def enumerate_node_collection(collectionpath, configmanager): - if collectionpath == ['node']: # it is just '/node/', need a list of nodes + if collectionpath == ['nodes']: # it is just '/node/', need a list of nodes return iterate_collections(configmanager.get_nodes()) node = collectionpath[1] if not configmanager.is_node(node): @@ -203,7 +203,7 @@ def handle_path(path, operation, configmanager, inputdata=None): del pathcomponents[-1] if not pathcomponents: # root collection list return enumerate_collections(rootcollections) - elif pathcomponents[0] == 'nodegroup': + elif pathcomponents[0] == 'groups': try: group = pathcomponents[1] except IndexError: @@ -229,7 +229,7 @@ def handle_path(path, operation, configmanager, inputdata=None): nodes=None, element=pathcomponents, configmanager=configmanager, inputdata=inputdata) - elif pathcomponents[0] in ('node', 'system', 'vm'): + elif pathcomponents[0] in ('nodes', 'system', 'vm'): #single node request of some sort try: node = pathcomponents[1]